Commit 8191f5d2 authored by 赵啸非's avatar 赵啸非

删除工程目录

parent b0a122da

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mortals.xhx</groupId>
<artifactId>dataCenter-common-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dataCenter-common-lib</name>
<description>公共依赖库</description>
<parent>
<groupId>com.mortals.xhx</groupId>
<artifactId>xhx-base</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.mortals.framework</groupId>
<artifactId>mortals-framework-springcloud</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
\ No newline at end of file
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 区域级别
*
* @author yiqimin
* @create 2018/09/26
*/
public enum AreaLevelEnum implements IBaseEnum {
PROVINCE(1, "省", SysConstains.STYLE_DEFAULT),
CITY(2, "市", SysConstains.STYLE_DEFAULT),
AREA(3, "区/县", SysConstains.STYLE_DEFAULT),
TOWN(4, "镇", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
AreaLevelEnum(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static AreaLevelEnum getByValue(int value) {
for (AreaLevelEnum e : AreaLevelEnum.values()) {
if (e.getValue() == value) {
return e;
}
}
return null;
}
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (AreaLevelEnum item : AreaLevelEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 资源类型
* @author
*
*/
public enum AuthType implements IBaseEnum {
UNLIMITED(0, "无限制", SysConstains.STYLE_DEFAULT),
UNLOGIN(1, "无需登录查看", SysConstains.STYLE_DEFAULT),
LOGIN(2, "需要登录查看", SysConstains.STYLE_DEFAULT),
AUTH(3, "需要角色权限查看", SysConstains.STYLE_PRIMARY);
//0:无限制,1:无需登录查看,2:需要登录查看,3:需要角色权限查看,默认3
private int value;
private String desc;
private String style;
AuthType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static AuthType getByValue(int value) {
for (AuthType examStatus : AuthType.values()) {
if (examStatus.getValue() == value) {
return examStatus;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (AuthType item : AuthType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
public enum CompareTypeEnum implements IBaseEnum {
DAY(1, "按日"),
MONTH(2, "按月");
private int value;
private String desc;
CompareTypeEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
@Override
public int getValue() {
return this.value;
}
@Override
public String getDesc() {
return this.desc;
}
public static Map<String,String> getEnumMap() {
Map<String, String> resultMap= new LinkedHashMap<String, String>();
for (CompareTypeEnum item : CompareTypeEnum.values()) {
resultMap.put(item.getValue() + "", item.getDesc());
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 资源类型
* @author
*
*/
public enum DataSatus implements IBaseEnum {
DISENABLE(0, "禁用", SysConstains.STYLE_DEFAULT),
ENABLE(1, "启用", SysConstains.STYLE_DEFAULT),
CLOSE(2, "注销", SysConstains.STYLE_DEFAULT),
DELETE(3, "已删除", SysConstains.STYLE_DEFAULT),
OVERDUE(4, "过期", SysConstains.STYLE_DEFAULT),
USEOUT(5, "用完", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
DataSatus(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static DataSatus getByValue(int value) {
for (DataSatus examStatus : DataSatus.values()) {
if (examStatus.getValue() == value) {
return examStatus;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (DataSatus item : DataSatus.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 资源类型
* @author
*
*/
public enum DataSatusEnum {
DISENABLE(0, "禁用"),
ENABLE(1, "启用"),
CLOSE(2, "注销"),
DELETE(3, "已删除"),
OVERDUE(4, "过期"),
USEOUT(5, "用完");
private int value;
private String desc;
DataSatusEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public static DataSatusEnum getByValue(int value) {
for (DataSatusEnum examStatus : DataSatusEnum.values()) {
if (examStatus.getValue() == value) {
return examStatus;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (DataSatusEnum item : DataSatusEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
public enum MenuAuthType implements IBaseEnum{
/** 无限制 */
UNLIMIT(0, "无限制", SysConstains.STYLE_DEFAULT),
/** 无需登录查看 */
WITHOUTLOGIN(1, "无需登录查看", SysConstains.STYLE_DEFAULT),
/** 需要登录查看 */
WITHLOGIN(2, "需要登录查看", SysConstains.STYLE_DEFAULT),
/** 需要角色权限查看 */
WITHAUTHORITY(3, "需要角色权限查看", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
MenuAuthType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static MenuAuthType getByValue(int value) {
for (MenuAuthType menuAuthType : MenuAuthType.values()) {
if (menuAuthType.getValue() == value) {
return menuAuthType;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (MenuAuthType item : MenuAuthType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
public enum MenuComm implements IBaseEnum{
/** 非常用 */
UNCOMMON(0, "非常用", SysConstains.STYLE_DEFAULT),
/** 常用 */
COMMON(1, "常用", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
MenuComm(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static MenuComm getByValue(int value) {
for (MenuComm menuComm : MenuComm.values()) {
if (menuComm.getValue() == value) {
return menuComm;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (MenuComm item : MenuComm.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
public enum MenuLinkType implements IBaseEnum{
/** 普通 */
NORMAL(0, "普通", SysConstains.STYLE_DEFAULT),
/** 弹出 */
POP(1, "弹出", SysConstains.STYLE_DEFAULT),
/** 脚本(JavaScript) */
SCRIPT(2, "脚本", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
MenuLinkType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static MenuLinkType getByValue(int value) {
for (MenuLinkType menuLinkType : MenuLinkType.values()) {
if (menuLinkType.getValue() == value) {
return menuLinkType;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (MenuLinkType item : MenuLinkType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
public enum MenuType implements IBaseEnum{
/** 主菜单 */
MAIN(0, "主菜单", SysConstains.STYLE_DEFAULT),
/** 非主菜单 */
UNMAIN(1, "非主菜单", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
MenuType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static MenuType getByValue(int value) {
for (MenuType menuType : MenuType.values()) {
if (menuType.getValue() == value) {
return menuType;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (MenuType item : MenuType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 参数修改状态
* @author
*
*/
public enum ModStatusEnum {
/** 页面隐藏 */
HIDDEN(0, "隐藏"),
/** 页面可查看 */
VIEW(1, "查看"),
/** 页面可修改 */
EDIT(2, "修改"),
/** 页面可删除 */
DELETE(3, "删除"),
/** 页面可修改删除 */
EDITANDDELETE(4, "修改删除");
private int value;
private String desc;
ModStatusEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public static ModStatusEnum getByValue(int value) {
for (ModStatusEnum modStatus : ModStatusEnum.values()) {
if (modStatus.getValue() == value) {
return modStatus;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (ModStatusEnum item : ModStatusEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.HashMap;
import java.util.Map;
/**
* Created by chendilin on 2018/3/7.
*/
public enum OperTypeEnum {
SAVE(0,"添加"),
UPDATE(1,"更新"),
DELETE(2,"删除"),
OTHER(-1,"其它");
private int value;
private String msg;
private OperTypeEnum(int value,String msg) {
this.value = value;
this.msg = msg;
}
public int getValue() {
return this.value;
}
public static Map<String,String> getEnumMap(){
Map<String,String> resultMap = new HashMap<>();
OperTypeEnum[] operTypeEnum = OperTypeEnum.values();
for (OperTypeEnum typeEnum : operTypeEnum) {
resultMap.put(String.valueOf(typeEnum.value),typeEnum.msg);
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
/**
* 业务统一返回码
* @author linlc
*
*/
public enum ResultCodeEnum {
CODE_001(156001,"参数类型错误"),
CODE_002(156002,"部分参数为空"),
CODE_003(156003,"参数长度超过限制"),
CODE_004(156004,"日期格式错误"),
CODE_005(156005,"时间区间不合法"),
CODE_006(156006,"远端服务不可用"),
CODE_007(156007,"无效的签名"),
CODE_008(156008,"不合法的 AppID ,请开发者检查 AppID 的正确性,避免异常字符,注意大小写"),
CODE_009(156009,"请求来源地址不合法"),
CODE_010(156010,"没有相应的用户"),
CODE_011(156011,"不合法的文件类型"),
CODE_012(156012,"不合法的文件大小"),
CODE_013(156013,"上传文件缺失"),
CODE_014(156014,"不支持的图片格式"),
CODE_015(156015,"无效的url"),
CODE_016(156016,"设备编号不合法"),
CODE_017(356017,"设备编号不存在"),
CODE_018(356018,"设备当前在线状态为“离线”,无法使用!"),
CODE_019(356019,"设备当前投放状态为“待重投”,无法使用!"),
CODE_020(356020,"设备当前投放状态为“已报废”,无法使用!"),
CODE_021(356021,"设备当前投放状态为“初始化”,无法使用!"),
CODE_022(356022,"此设备当前启用状态为“禁用”,无法使用!"),
CODE_023(356023,"API 调用太频繁,请稍候再试"),
CODE_024(256024,"用户未授权该 api"),
CODE_025(156025,"解析 JSON/XML 内容错误"),
CODE_FAILUER(-1,"失败");
private int value;
private String desc;
ResultCodeEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
public int getValue() {
return value;
}
public String getDesc() {
return desc;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 角色类型
* @author
*
*/
public enum RoleType implements IBaseEnum {
/** 系统内置角色 */
BUILT_IN(0, "系统内置角色", SysConstains.STYLE_DEFAULT),
/** 默认系统角色 */
SYSTEM_DEFAULT(1, "默认系统角色", SysConstains.STYLE_INFO),
/** 企业用户角色 */
CUSTOMER_DEFAULT(2, "企业用户角色", SysConstains.STYLE_PRIMARY),
/** 普通角色 */
NORMAL(4, "普通角色 ", SysConstains.STYLE_SUCCESS),;
//0:系统内置角色(不可删除),1:默认系统角色,2:默认新闻用户角色,3:默认资讯用户角色,4:普通角色,默认4
private int value;
private String desc;
private String style;
RoleType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static RoleType getByValue(int value) {
for (RoleType examStatus : RoleType.values()) {
if (examStatus.getValue() == value) {
return examStatus;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (RoleType item : RoleType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 资源类型
* @author
*
*/
public enum SourceType implements IBaseEnum {
/** 系统资源 */
SYSTEM(0, "系统资源", SysConstains.STYLE_DEFAULT),
/** 开放资源 */
OPEN(1, "开放资源", SysConstains.STYLE_PRIMARY);
private int value;
private String desc;
private String style;
SourceType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static SourceType getByValue(int value) {
for (SourceType examStatus : SourceType.values()) {
if (examStatus.getValue() == value) {
return examStatus;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (SourceType item : SourceType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author
* @create 2018/01/12
*/
public enum TaskExcuteStatusEnum {
WAIT_RUN(0, "待执行"),
RUNNING(1, "执行中"),
SUCCESS_RUN(2, "执行成功"),
FAIL_RUN(3, "执行失败"),
CANCEL(4, "取消");
private int value;
private String desc;
TaskExcuteStatusEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
public int getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static TaskExcuteStatusEnum getByValue(int value) {
for (TaskExcuteStatusEnum taskExcuteStatusEnum : TaskExcuteStatusEnum.values()) {
if (taskExcuteStatusEnum.getValue() == value) {
return taskExcuteStatusEnum;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (TaskExcuteStatusEnum item : TaskExcuteStatusEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
public enum TaskExcuteStrategyEnum{
/** 按日 */
DAY(1, "按日"),
/** 按周 */
WEEK(2, "按周"),
/** 按月 */
MONTH(3, "按月"),
/** 按间隔时间 */
INTERVAL(4, "按间隔时间");
private int value;
private String desc;
TaskExcuteStrategyEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public static TaskExcuteStrategyEnum getByValue(int value) {
for (TaskExcuteStrategyEnum taskExcuteStrategy : TaskExcuteStrategyEnum.values()) {
if (taskExcuteStrategy.getValue() == value) {
return taskExcuteStrategy;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (TaskExcuteStrategyEnum item : TaskExcuteStrategyEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
public enum TaskInterimExcuteStatusEnum{
/** 未启用 */
UNUSE(0, "未启用"),
/** 立即执行并保留 */
IMMEDIATE_EXECUTION(1, "立即执行并保留"),
/** 立即执行并删除 */
IMMEDIATE_EXECUTION_BEFORE_DELETE(2, "立即执行并删除");
private int value;
private String desc;
TaskInterimExcuteStatusEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public static TaskInterimExcuteStatusEnum getByValue(int value) {
for (TaskInterimExcuteStatusEnum taskInterimExcuteStatus : TaskInterimExcuteStatusEnum.values()) {
if (taskInterimExcuteStatus.getValue() == value) {
return taskInterimExcuteStatus;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (TaskInterimExcuteStatusEnum item : TaskInterimExcuteStatusEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.common.IBaseEnum;
/**
* 上传文件类型枚举
*
* @author pengziyuan
*/
public enum UploadFileType implements IBaseEnum {
/** 表格 */
EXCEL(1, "表格", 1024 * 1023 * 100),
/** 图片 */
IMG(2, "图片", 1024 * 1024 * 10),
/** 压缩文件 */
ZIP(3, "压缩文件", 1024 * 1024 * 100),
/** PDF */
PDF(4, "PDF", 1024 * 1024 * 100),
/** 其他 */
OTHER(99, "其他", 1024 * 1024 * 100);
private int value;
private String desc;
private int maxSize;
UploadFileType(int value, String desc, int maxSize) {
this.value = value;
this.desc = desc;
this.maxSize = maxSize;
}
@Override
public int getValue() {
return this.value;
}
@Override
public String getDesc() {
return desc;
}
public int getMaxSize() {
return maxSize;
}
public static UploadFileType getFileType(String extension) {
if ("xls".equalsIgnoreCase(extension) || "xlsx".equalsIgnoreCase(extension)) {
return EXCEL;
}
if ("jpg".equalsIgnoreCase(extension) || "jpeg".equalsIgnoreCase(extension) || "png".equalsIgnoreCase(extension)
|| "gif".equalsIgnoreCase(extension)) {
return IMG;
}
if ("zip".equalsIgnoreCase(extension)) {
return ZIP;
}
if ("pdf".equalsIgnoreCase(extension)) {
return PDF;
}
return OTHER;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
public enum ValidCodeType implements IBaseEnum{
IMAGE(0, "图片校验", SysConstains.STYLE_DEFAULT),
MOBILE(1, "手机校验", SysConstains.STYLE_DEFAULT),
EMAIL(2, "邮箱校验", SysConstains.STYLE_DEFAULT);
private int value;
private String desc;
private String style;
ValidCodeType(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public String getStyle()
{
return style;
}
public static ValidCodeType getByValue(int value) {
for (ValidCodeType validCodeType : ValidCodeType.values()) {
if (validCodeType.getValue() == value) {
return validCodeType;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (ValidCodeType item : ValidCodeType.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.code;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
public enum YesNoEnum implements IBaseEnum{
NO(0, "否"),
YES(1, "是");
private int value;
private String desc;
YesNoEnum(int value, String desc) {
this.value = value;
this.desc = desc;
}
@Override
public int getValue() {
return this.value;
}
public String getDesc() {
return desc;
}
public static YesNoEnum getByValue(int value) {
for (YesNoEnum YesNoEnum : YesNoEnum.values()) {
if (YesNoEnum.getValue() == value) {
return YesNoEnum;
}
}
return null;
}
/**
* 获取Map集合
* @param eItem 不包含项
* @return
*/
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (YesNoEnum item : YesNoEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
package com.mortals.xhx.common.keys;
import java.math.BigDecimal;
/**
* 业务参数类,这个类全部为field参数,可以直接从外部设置和获取
*
* @author karlhoo
*/
public final class BusizParams {
public static int WORK_ID;
/**
* 无限常量:-1
*/
public static int NO_LIMIT = -1;
/**
* 一天的分钟数
*/
public static long DAY_MINUTES = 24 * 60;
/**
* 现金类押金支付金额默认折扣
*/
public static BigDecimal DEFAULT_CASH_DEPOSIT_DISCOUNT = new BigDecimal("1.0");
/**
* 押金默认计费上限费用
*/
public static Long DEFAULT_BILL_LIMIT_FEE = 20000L;
/**
* 现金押金默认计费上限费用
*/
public static Long DEFAULT_CASH_BILL_LIMIT_FEE = 8000L;
/**
* 用户冻结的默认延时
*/
public static Integer DEFAULT_CUSTOMER_FREEZE_DELAY = 121;
/**
* 用户冻结的默认时长
*/
public static Integer DEFAULT_CUSTOMER_FREEZE_LENGHT = 1440;
/**
* 系统参数:按摩椅下发命令间隔时间(单位:秒,默认值:10秒)
*/
public static String SYS_PARAM_CHAIR_ISCMDRSP_INTERVAL = "chair_iscmdrsp_interval";
/**
* 系统参数:闪充待支付超时时间(单位:秒,默认值:600秒)
*/
public static String SYS_PARAM_WIRE_WAITLOAN_TIMEOUT = "wire_waitloan_timeout";
/**
* 系统参数:filetoken过期时间(单位:天,默认值:1天)
*/
public static String SYS_PARAM_PRINT_FILETOKEN_TIMEOUT = "print_filetoken_timeout";
/**
* 系统参数:打印机保存文件过期时间(单位:月,默认值:3)
*/
public static String SYS_PARAM_PRINT_FILE_TIMEOUT = "print_orderfile_timeout";
/**
* 系统参数:打印机保存文件存储使用方式(0:本地存储,1:fastdfs存储)
*/
public static String SYS_PARAM_PRINT_FILE_STORE_MODE = "print_file_store_mode";
/**
* 系统参数:word文件转换方式
*/
public static String SYS_PARAM_PRINT_WORD_CONVERT_METHOD = "print_word_convert_method";
/**
* 系统参数:文件访问域
*/
public static String SYS_PARAM_FILE_DOMAIN = "file_domain";
}
package com.mortals.xhx.common.keys;
/**
* 关键操作失败时,用来缓存数据的logger名称
*
* @author karlhoo
*/
public interface CacheLoggers {
}
package com.mortals.xhx.common.keys;
/**
* redis缓存参数key
*
* @author karlhoo
*/
public final class RedisCacheKeys {
/**
* @return 文件访问的地址
*/
public static String getFileUrlKey() {
return "params:file:upload";
}
public static String getCoopsDistributedLockKey() {
return "coops:distributed:lock";
}
}
package com.mortals.xhx.common.keys;
/**
* 服务调用响应常量
*
* @author karlhoo
*/
public interface ResponseConstants {
/**
* 请求结果Code主键
*/
String KEY_RESULT_CODE = "code";
/**
* 请求结果Message主键
*/
String KEY_RESULT_MSG = "msg";
/**
* 请求结果Code值-成功
*/
int RESULT_VALUE_SUCCESS = 1;
/**
* 请求结果Code值-失败
*/
int RESULT_VALUE_FAILURE = -1;
}
\ No newline at end of file
package com.mortals.xhx.common.model;
import java.util.List;
import com.mortals.framework.model.PageInfo;
/**
* 列表查询结果数据
* @author lyb
*/
public class ListQueryResult<T> {
/**
* 列表数据
*/
private List<T> list;
/**
* 分页信息
*/
private PageInfo page;
public ListQueryResult() {
}
public ListQueryResult(List<T> list, PageInfo page) {
this.list = list;
this.page = page;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
public PageInfo getPage() {
return page;
}
public void setPage(PageInfo page) {
this.page = page;
}
}
package com.mortals.xhx.common.model;
import java.util.HashMap;
import java.util.Map;
import com.mortals.framework.exception.AppException;
/**
* 请求结果
* @author lyb
*
* @param <T> 响应结果数据
*/
public class RequestResult<T> {
/**
* 响应码
*/
private Integer code;
/**
* 响应码描述
*/
private String msg;
/**
* 响应结果数据
*/
private T data;
/**
* 字典信息
*/
private Map<String, Map<String, String>> dict;
public RequestResult() {
this(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMsg());
}
public RequestResult(ResponseCode code) {
this(code.getCode(), code.getMsg());
}
public RequestResult(AppException e) {
this(e.getCode(), e.getMessage());
}
public RequestResult(T data) {
this(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMsg(), data);
}
public RequestResult(Integer code, String msg) {
this(code, msg, null);
}
public RequestResult(Integer code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public boolean isSuccess() {
return ResponseCode.SUCCESS.getCode().equals(this.code);
}
public boolean isFailure() {
return !isSuccess();
}
public void addDict(String name, Map<String, String> dict) {
if (this.dict == null) {
this.dict = new HashMap<String, Map<String, String>>();
}
this.dict.put(name, dict);
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public Map<String, Map<String, String>> getDict() {
return dict;
}
public void setDict(Map<String, Map<String, String>> dict) {
this.dict = dict;
}
public static enum ResponseCode {
/**
* 请求处理成功
*/
SUCCESS(1, "请求处理成功"),
/**
* 请求处理失败
*/
FAILURE(-1, "请求处理失败");
/**
* 响应码
*/
private Integer code;
/**
* 响应码描述
*/
private String msg;
private ResponseCode(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
}
package com.mortals.xhx.common.model;
/**
* 用户信息
* @author lyb
*/
public class UserInfo {
/**
* 用户ID
*/
private Long userId;
/**
* 用户名称
*/
private String userName;
public UserInfo() {
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
package com.mortals.xhx.common.pdu.api;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class ApiReqPdu<T> {
/**
* 会员编号
*/
private Member member;
/**
* 透传数据
*/
private T transmission;
}
package com.mortals.xhx.common.pdu.api;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class ApiRespPdu<T> {
/**
* 结果编码
*/
private int code;
/**
* 结果描述
*/
private String msg;
/**
* 响应数据
*/
private T data;
}
package com.mortals.xhx.common.pdu.api;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class Member {
/**
* 会员编号
*/
private String code;
/**
* 会员手机号码
*/
private String phone;
}
package com.mortals.xhx.common.pdu.api;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class Page {
/**
* 每页记录数
*/
private int per;
/**
* 当前请求页数
*/
private int size;
/**
* 总页数
*/
private int total;
}
package com.mortals.xhx.common.pdu.sms;
import lombok.Data;
@Data
public class SmsSendReq {
private String mobile;
private String templeteId;
private String[] params;
}
package com.mortals.xhx.common.pdu.sms;
import lombok.Data;
@Data
public class SmsSendResp {
}
package com.mortals.xhx.feign;
public interface IFeign {
}
package com.mortals.xhx.feign.api;
import com.mortals.xhx.common.pdu.sms.SmsSendReq;
import com.mortals.xhx.feign.IFeign;
import com.mortals.framework.exception.AppException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @描述
* @创建人 zxfei
* @创建时间 2021/1/19
* @修改人和其它信息
*/
@FeignClient(name = "${application.register.service-name:coops-gate-api/m}")
public interface IApiGateFeign extends IFeign {
/**
* 短信发送
* @param
* @return
* @throws AppException
*/
@PostMapping(value = "/sms/send")
String smsSend(SmsSendReq smsSendReq) throws AppException;
}
package com.mortals.xhx.feign.system.param;
import com.mortals.xhx.feign.IFeign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @author karlhoo
*/
@FeignClient("${application.register.service-name:coops-manager}")
public interface IParamFeign extends IFeign {
/**
* 获取所有参数值
* @return
*/
@PostMapping("param/get/all/param/value")
String getAllParamValue();
//
// /**
// * 获取参数值(如果数据库不存在该键值,则返回空串,如果存在,则返回相应值)
// *
// * @param key 键
// * @return
// */
// @PostMapping("param/get/param/value/key")
// String getParamValue(@RequestParam("key") String key);
//
// /**
// * 获取参数值(如果数据库不存在该键值,则返回传入的默认值,如果存在,则返回相应值)
// *
// * @param key 键
// * @param defaultValue 默认值
// * @return
// */
// @PostMapping("param/get/param/value/key/default")
// String getParamValue(@RequestParam("key") String key, @RequestParam("defaultValue") String defaultValue);
// /**
// * 参数配置中是否包含指定键
// *
// * @param key
// * @return
// */
// @PostMapping("param/contains/param/key")
// boolean containsParamKey(@RequestParam("key") String key);
//
// /**
// * 获取参数配置信息
// *
// * @param key
// * @return
// */
// @PostMapping("param/get/param/by/key")
// IParam getParamByKey(@RequestParam("key") String key);
//
// /**
// * 获取int参数值(如果数据库不存在该键值,则返回空串,如果存在,且值可转换成int,则返回相应值,否则返回该键的默认值)
// *
// * @param key
// * @return
// */
// @PostMapping("param/get/param/int/value/key")
// int getParamIntValue(@RequestParam("key") String key);
//
// /**
// * 获取int参数值(如果数据库不存在该键值或该键对应的值不能转换成int时,则返回传入的默认值,如果存在,则返回相应值)
// *
// * @param key
// * @param defaultValue
// * @return
// */
// @PostMapping("param/get/param/int/value/key/default")
// int getParamIntValue(@RequestParam("key") String key, @RequestParam("defaultValue") int defaultValue);
//
// /**
// * 获取long参数值(如果数据库不存在该键值,则返回空串,如果存在,且值可转换成long,则返回相应值,否则返回该键的默认值)
// *
// * @param key
// * @return
// */
// @PostMapping("param/get/param/long/value/key")
// long getParamLongValue(@RequestParam("key") String key);
//
// /**
// * 获取long参数值(如果数据库不存在该键值或该键对应的值不能转换成long时,则返回传入的默认值,如果存在,则返回相应值)
// *
// * @param key
// * @param defaultValue
// * @return
// */
// @PostMapping("param/get/param/long/value/key/default")
// long getParamLongValue(@RequestParam("key") String key, @RequestParam("defaultValue") long defaultValue);
//
// /**
// * 获取boolean参数值(如果数据库不存在该键值,则返回空串,如果存在,且值可转换成boolean,则返回相应值,否则返回该键的默认值)
// *
// * @param key
// * @return
// */
// @PostMapping("param/get/param/boolean/value/key")
// boolean getParamBooleanValue(@RequestParam("key") String key);
//
// /**
// * 获取boolean参数值(如果数据库不存在该键值或该键对应的值不能转换成boolean时,则返回传入的默认值,如果存在,则返回相应值)
// *
// * @param key
// * @param defaultValue
// * @return
// */
// @PostMapping("param/get/param/boolean/value/key/default")
// boolean getParamBooleanValue(@RequestParam("key") String key, @RequestParam("defaultValue") boolean defaultValue);
}
/*
package com.mortals.pstation.tools.lock.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
*/
/**
* @author karlhoo
*//*
@Data
@Configuration
@ConditionalOnProperty("application.zookeeper.nodes")
public class ZookeeperConfiguration {
*/
/* *//*
*/
/**
* zookeeper节点地址
*//*
*/
/*
@Value("${application.zookeeper.nodes}")
private String zookeeperNodes;
*//*
*/
/**
* session连接超时时间(单位:ms)
*//*
*/
/*
@Value("${application.zookeeper.session-timeout-ms:60000}")
private Integer sessionTimeoutMs;
*//*
*/
/**
* 连接超时时间(单位:ms)
*//*
*/
/*
@Value("${application.zookeeper.connection-timeout-ms:5000}")
private Integer connectionTimeoutMs;
*//*
*/
/**
* 连接失败最大重试次数
*//*
*/
/*
@Value("${application.zookeeper.max-retry:3}")
private Integer maxRetry;
*//*
*/
/**
* 连接失败重试间隔时间(单位:ms)
*//*
*/
/*
@Value("${application.zookeeper.retry-interval-ms:1000}")
private Integer retryIntervalMs;
*//*
*/
/**
* 获取锁超时时间(单位:sec)
*//*
*/
/*
@Value("${application.zookeeper.lock-timeout-sec:5}")
private Integer lockTimeoutSec;
*//*
*/
/**
* 使用者标识
*//*
*/
/*
@Value("${application.user.mark}")
private String userMark;
*//*
*/
/**
* 配置文件标识
*//*
*/
/*
@Value("${spring.cloud.config.profile}")
private String configProfile;*//*
}
*/
package com.mortals.xhx.tools.lock.service;
import com.mortals.framework.exception.AppException;
import org.springframework.validation.annotation.Validated;
/**
* @author karlhoo
* <p>
* 分布式锁的加锁和解锁
*/
@Validated
public interface ILockService {
/**
* 分布式锁-加锁
*
* @param lockKey
* @return true 成功
*/
boolean lock(String lockKey);
/**
* 分布式锁-加锁
*
* @param lockKey
* @param unlockSec 自动解锁失效,单位:秒
* @return true 成功
*/
boolean lock(String lockKey, Long unlockSec);
/**
* 分布式锁-解锁(和lock方法成对使用,加锁后一定要解锁)
* @return
* @throws AppException
*/
boolean unlock() throws AppException;
}
//package com.mortals.pstation.tools.lock.service.impl;
//
//import com.mortals.pstation.tools.lock.config.ZookeeperConfiguration;
//import com.mortals.pstation.tools.lock.service.ILockService;
//import lombok.extern.apachecommons.CommonsLog;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.curator.framework.CuratorFramework;
//import org.apache.curator.framework.CuratorFrameworkFactory;
//import org.apache.curator.framework.recipes.locks.InterProcessMutex;
//import org.apache.curator.retry.RetryNTimes;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.PostConstruct;
//import java.util.concurrent.TimeUnit;
//
///**
// * @author karlhoo
// */
//@CommonsLog
//@Service("defaultLockService")
//@ConditionalOnBean(ZookeeperConfiguration.class)
//public class DefaultLockServiceImpl implements ILockService {
// @Autowired
// private ZookeeperConfiguration zookeeperConfiguration;
// private CuratorFramework curatorClient;
// private String LOCK_KEY_PREFIX;
// private ThreadLocal<InterProcessMutex> interProcessMutexThreadLocal = new ThreadLocal<>();
//
// @Override
// public boolean lock(String lockKey) {
// InterProcessMutex lock = new InterProcessMutex(getCuratorClient(), LOCK_KEY_PREFIX + (StringUtils.isBlank(lockKey) ? "/" : lockKey));
// try {
// if (lock.acquire(zookeeperConfiguration.getLockTimeoutSec(), TimeUnit.SECONDS)) {
// interProcessMutexThreadLocal.set(lock);
// return true;
// }
// } catch (Exception e) {
// log.warn("获取分布式锁报错", e);
// }
// return false;
// }
//
// @Override
// public void unlock() {
// try {
// interProcessMutexThreadLocal.get().release();
// } catch (Exception e) {
// log.warn("释放分布式锁报错", e);
// } finally {
// interProcessMutexThreadLocal.remove();
// }
// }
//
// private CuratorFramework getCuratorClient() {
// if (curatorClient == null) {
// this.curatorClient = CuratorFrameworkFactory.newClient(
// zookeeperConfiguration.getZookeeperNodes(), zookeeperConfiguration.getSessionTimeoutMs(),
// zookeeperConfiguration.getConnectionTimeoutMs(), new RetryNTimes(zookeeperConfiguration.getMaxRetry(), zookeeperConfiguration.getRetryIntervalMs()));
// this.curatorClient.start();
// }
// return this.curatorClient;
// }
//
// @PostConstruct
// public void init() {
// StringBuilder lockKeyPrefixBuilder = new StringBuilder("/sms/lock/");
// if (StringUtils.isNotEmpty(zookeeperConfiguration.getUserMark())) {
// lockKeyPrefixBuilder.append(zookeeperConfiguration.getUserMark()).append("/");
// }
// if (StringUtils.isNotEmpty(zookeeperConfiguration.getConfigProfile())) {
// lockKeyPrefixBuilder.append(zookeeperConfiguration.getConfigProfile()).append("/");
// }
// LOCK_KEY_PREFIX = lockKeyPrefixBuilder.toString();
// }
//}
//
package com.mortals.xhx.tools.lock.service.impl;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.common.keys.RedisCacheKeys;
import com.mortals.xhx.tools.lock.service.ILockService;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
/**
* redis 实现分布式锁机制
* @author zxfei
*/
@CommonsLog
@Service("redisLockService")
//@ConditionalOnProperty("application.cache.redis")
public class RedisLockServiceImpl implements ILockService {
private static ThreadLocal<String> threadLocal = new ThreadLocal<>();
@Autowired
private ICacheService cacheService;
@Override
public boolean lock(String lockKey) {
return lock(lockKey, null);
}
@Override
public boolean lock(String lockKey, Long unlockSec) {
try {
boolean ret;
if (ObjectUtils.isEmpty(unlockSec)) {
ret = cacheService.hincrBy(RedisCacheKeys.getCoopsDistributedLockKey(), lockKey, 1) == 1;
} else {
ret = cacheService.hincrByForTime(RedisCacheKeys.getCoopsDistributedLockKey(), lockKey, 1, unlockSec) == 1;
}
if (ret) {
threadLocal.set(lockKey);
}
return ret;
} catch (Exception e) {
log.error(String.format("分布式加锁出错 lockKey:%s%s", lockKey, ObjectUtils.isEmpty(unlockSec) ? "" : ",unlockSec:" + unlockSec), e);
return false;
}
}
@Override
public boolean unlock() {
try {
cacheService.hdel(RedisCacheKeys.getCoopsDistributedLockKey(), threadLocal.get());
threadLocal.remove();
return true;
} catch(Exception e) {
log.error(String.format("分布式解锁出错 lockKey:%s", threadLocal.get()), e);
return false;
}
}
}
/*
package com.mortals.coops.tools.message.channel;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.messaging.SubscribableChannel;
*/
/**
* @author karlhoo
*//*
public interface SystemParamSink {
String INPUT = "system-param-input";
@Input(SystemParamSink.INPUT)
SubscribableChannel input();
}
*/
/*
package com.mortals.coops.tools.message.channel;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
*/
/**
* @author karlhoo
*//*
public interface SystemParamSource {
String OUTPUT = "system-param-output";
@Output(SystemParamSource.OUTPUT)
MessageChannel output();
}
*/
/*
package com.mortals.coops.tools.message.listener;
import com.mortals.coops.utils.GlobalSystemParamUtil;
import com.mortals.coops.tools.message.channel.SystemParamSink;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.stereotype.Component;
*/
/**
* @author karlhoo
*//*
@Component
@EnableBinding(SystemParamSink.class)
@ConditionalOnBean(GlobalSystemParamUtil.class)
public class SystemParamListener {
@Autowired
private GlobalSystemParamUtil globalSystemParamUtil;
*/
/**
* 接收系统参数更新通知
*//*
*/
/* @StreamListener(target = SystemParamSink.INPUT)
public void systemParamListener(ParamEntity param) {
globalSystemParamUtil.updateParam(param);
}*//*
}
*/
/*
package com.mortals.coops.tools.message.service;
import org.springframework.messaging.MessageChannel;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
*/
/**
* 发送消息到消息中间件
*
* @author karlhoo
*//*
@Validated
public interface IMessageService {
*/
/**
* 向指定通道发送消息
*
* @param messageChannel
* @param message
* @return true: 成功
*//*
boolean sendMessage(@NotNull(message = "messageChannel不能为null") MessageChannel messageChannel, @NotBlank(message = "message不能为空") String message);
*/
/**
* 向指定通道发送消息(带messageKey)
*
* @param messageChannel
* @param message
* @param messageKey
* @return true: 成功
*//*
boolean sendMessage(@NotNull(message = "messageChannel不能为null") MessageChannel messageChannel, @NotBlank(message = "message不能为空") String message, String messageKey);
}
*/
//package com.mortals.coops.tools.message.service.impl;
//
//import com.mortals.coops.tools.message.service.IMessageService;
//import lombok.extern.apachecommons.CommonsLog;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.kafka.support.KafkaHeaders;
//import org.springframework.messaging.Message;
//import org.springframework.messaging.MessageChannel;
//import org.springframework.messaging.support.MessageBuilder;
//import org.springframework.stereotype.Service;
//
///**
// * @author karlhoo
// */
//
//@CommonsLog
//@Service
//@ConditionalOnProperty("spring.cloud.stream.kafka.binder.brokers")
//public class DefaultMessageServiceImpl implements IMessageService {
// @Override
// public boolean sendMessage(MessageChannel messageChannel, String message) {
// return sendMessage(messageChannel, message, null);
// }
//
// @Override
// public boolean sendMessage(MessageChannel messageChannel, String message, String messageKey) {
// return sendMessage(messageChannel, MessageBuilder.withPayload(message).setHeader(KafkaHeaders.MESSAGE_KEY, messageKey == null ? messageKey : messageKey.getBytes()).build());
// }
//
// private boolean sendMessage(MessageChannel messageChannel, Message message) {
// try {
// return messageChannel.send(message);
// } catch (Exception e) {
// log.error(String.format("提交消息出错 messageChannel: %s, message: %s", messageChannel.toString(), message.getPayload()), e);
// return false;
// }
// }
//}
//
package com.mortals.xhx.tools.uid;
public interface ISeqGeneratorService {
/**
* 分布式订单号(本地生成)
* <p>
* 平台唯一ID,返馈给下游进行订单回执关联以及对帐,以及提供给上游订单号中的一部份
*
* @param workerId 工作主机ID(取值:0 ~ 1023)
* @return 18位的数字
*/
long nextOrderId(int workerId);
/**
* 解析分布式订单号
*
* @param orderId
* @return [0]:距离当前的毫秒时间,[1]:工作主机ID,[2]:序号
*/
Long[] parserOrderId(long orderId);
}
package com.mortals.xhx.tools.uid.impl;
import com.mortals.xhx.tools.uid.ISeqGeneratorService;
import org.springframework.stereotype.Service;
@Service("seqGeneratorService")
public class DefaultSeqGeneratorService implements ISeqGeneratorService {
@Override
public long nextOrderId(int workerId) {
return SeqGenerator.nextId(workerId);
}
@Override
public Long[] parserOrderId(long orderId) {
return SeqGenerator.parserId(orderId);
}
}
package com.mortals.xhx.tools.uid.impl;
public class SeqGenerator {
/**
* 开始时间截 (2017-01-01)
*/
private static final long twepoch = 1483200000000L;
/**
* 时间所占的位数
*/
private static final long timestampBits = 41L;
/**
* 机器id所占的位数
*/
private static final long workerIdBits = 10L;
/**
* 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数)
*/
private static final long maxWorkerId = -1L ^ (-1L << workerIdBits);
/**
* 序列在id中占的位数
*/
private static final long sequenceBits = 12L;
/**
* 机器ID向左移12位
*/
private static final long workerIdShift = sequenceBits;
/**
* 时间截向左移22位(10+12)
*/
private static final long timestampLeftShift = sequenceBits + workerIdBits;
/**
* 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095)
*/
private static final long sequenceMask = -1L ^ (-1L << sequenceBits);
/**
* 毫秒内序列(0~4095)
*/
private static long sequence = 0L;
/**
* 上次生成ID的时间截
*/
private static long lastTimestamp = -1L;
/**
* 分布式订单号<br>
* 为一个64位Long型数字,结构如下(每部分用-分开):<br>
* 0 - 0000000000 0000000000 0000000000 0000000000 0 - 0000000000 - 000000000000 <br>
* 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0<br>
* 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截),
* 这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序twepoch属性)。
* 41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
* 10位的数据机器位,可以部署在1024个节点<br>
* 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号
*
* @param workerId 工作主机ID(取值:0 ~ 1023)
*/
public static synchronized long nextId(int workerId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
long timestamp = timeGen();
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
if (timestamp < lastTimestamp) {
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
//如果是同一时间生成的,则进行毫秒内序列
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
//毫秒内序列溢出
if (sequence == 0) {
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
}
//时间戳改变,毫秒内序列重置
else {
sequence = 0L;
}
//上次生成ID的时间截
lastTimestamp = timestamp;
//移位并通过或运算拼到一起组成64位的ID
// System.out.println(String.format("timestamp:%d, workerId:%d, sequence:%d", timestamp - twepoch, workerId, sequence));
return ((timestamp - twepoch) << timestampLeftShift)
| (workerId << workerIdShift)
| sequence;
}
public static synchronized Long[] parserId(long id) {
long timestamp = id >>> timestampLeftShift;
long workerId = id << timestampBits + 1;
workerId = workerId >>> timestampBits + sequenceBits + 1;
long sequence = id << timestampBits + workerIdBits + 1;
sequence = sequence >>> timestampBits + workerIdBits + 1;
// System.out.println(String.format("timestamp:%d, workerId:%d, sequence:%d", timestamp, workerId, sequence));
return new Long[]{timestamp + twepoch, workerId, sequence};
}
/**
* 阻塞到下一个毫秒,直到获得新的时间戳
*
* @param lastTimestamp 上次生成ID的时间截
* @return 当前时间戳
*/
private static long tilNextMillis(long lastTimestamp) {
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
timestamp = timeGen();
}
return timestamp;
}
/**
* 返回以毫秒为单位的当前时间
*
* @return 当前时间(毫秒)
*/
private static long timeGen() {
return System.currentTimeMillis();
}
public static void main(String[] args) {
long id = nextId(1000);
System.out.println(id);
parserId(id);
}
}
\ No newline at end of file
package com.mortals.xhx.utils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.util.HashSet;
import java.util.Set;
public class BeanUtil
{
/**
*
* @Title: getNullPropertyNames
* @Description: 获取一个对象中属性值为null的属性名字符串数组
* @param source
* @return
*/
public static String[] getNullPropertyNames (Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<String>();
for(java.beans.PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
if (srcValue == null) emptyNames.add(pd.getName());
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
}
package com.mortals.xhx.utils;
import com.mortals.framework.util.DateUtils;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.util.ObjectUtils;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
/**
* @author karlhoo
*/
@CommonsLog
public class CommonUtils {
public static Collection<Collection<Long>> groupOrderIds(Collection<Long> rawIds) {
if (ObjectUtils.isEmpty(rawIds)) {
return new ArrayList<>();
}
Map<String, Collection<Long>> groupedIds = new HashMap<>(16);
for (Long id : rawIds) {
String time = getTimeById(id, DateUtils.P_yyyyMM);
if(groupedIds.containsKey(time)) {
groupedIds.get(time).add(id);
} else {
groupedIds.put(time, new ArrayList<Long>(){{add(id);}});
}
}
return groupedIds.values();
}
private static synchronized String getTimeById(long id, String dateFormat) {
return DateUtils.convertTime2Str((id >>> 22L) + 1483200000000L, dateFormat);
}
public static String getRelativePath(String url) {
URL url1 = null;
try {
url1 = new URL(url);
String path = url1.getPath();
url = path.substring(1);
} catch (MalformedURLException e) {
log.error("获取路径异常",e);
}
/* System.out.println(path);
Pattern p = Pattern.compile("(?<=//|)((\\w)+\\.)+\\w+");
Matcher m = p.matcher(url);
if(m.find()){
String group = m.group();
System.out.println(group);
if (url.startsWith("http://")) {
url=url.replaceAll("http://","");
int i = url.indexOf("/");
url.substring(i,url.length());
System.out.println(url);
// url = url.substring(8+group.length());
} else if (url.startsWith("https://")) {
url = url.substring(9+group.length());
} else if (url.startsWith("//")) {
url = url.substring(3+group.length());
}
}*/
return url;
}
public static void main(String[] args) throws MalformedURLException {
String url="https://iot-test1.oss-cn-shanghai.aliyuncs.com/oss/2019/12/09/dest/4f2cff5e50564b7faf282204d97c1aca.pdf?12";
System.out.println(CommonUtils.getRelativePath(url));
}
}
package com.mortals.xhx.utils;
import com.alibaba.fastjson.JSONObject;
import com.mortals.xhx.feign.system.param.IParamFeign;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author karlhoo
*/
@Component
@CommonsLog
@ConditionalOnProperty("spring.cloud.stream.bindings.system-param-input.destination")
public class GlobalSystemParamUtil {
@Autowired
@SuppressWarnings("all")
private IParamFeign paramFeign;
private static Map<String, String> paramMap = new ConcurrentHashMap<>(16);
public static String getParamStringValue(String key) {
return paramMap.get(key);
}
public static String getParamStringValue(String key,String defaultValue) {
if(StringUtils.isEmpty(paramMap.get(key))){
return defaultValue;
}
return paramMap.get(key);
}
public static Long getParamLongValue(String key) {
try {
return Long.parseLong(paramMap.get(key));
} catch (Exception e) {
return null;
}
}
public static Integer getParamIntValue(String key) {
try {
return Integer.parseInt(paramMap.get(key));
} catch (Exception e) {
return null;
}
}
public static Integer getParamIntValue(String key,Integer defaultValue) {
if(StringUtils.isEmpty(paramMap.get(key))){
return defaultValue;
}
return Integer.parseInt(paramMap.get(key));
}
@PostConstruct
public void init() {
log.info("开始加载系统参数...");
String paramString = paramFeign.getAllParamValue();
if (ObjectUtils.isEmpty(paramString)) {
log.info("系统参数加载完成,size:0");
return;
}
JSONObject jsonObject = JSONObject.parseObject(paramString);
if (!jsonObject.isEmpty()) {
jsonObject.keySet().forEach(k -> paramMap.put(k, jsonObject.getString(k)));
}
log.info("系统参数加载完成,size:" + paramMap.size());
}
/* public void updateParam(ParamEntity param) {
log.info("更新系统参数 key:" + param.getParamKey() + " value:" + param.getParamValue());
paramMap.put(param.getParamKey(), param.getParamValue());
}*/
}
//package com.mortals.coops.utils;
//
//import javax.validation.Constraint;
//import javax.validation.ConstraintValidator;
//import javax.validation.ConstraintValidatorContext;
//import javax.validation.Payload;
//import java.lang.annotation.*;
//import java.time.LocalDate;
//
//@Target({ElementType.FIELD})
//@Retention(RetentionPolicy.RUNTIME)
//@Constraint(validatedBy = PastLocalDate.PastValidator.class)
//@Documented
//public @interface PastLocalDate {
// String message() default "{javax.validation.constraints.Past.message}";
//
// Class<?>[] groups() default {};
//
// Class<? extends Payload>[] payload() default {};
//
// class PastValidator implements ConstraintValidator<PastLocalDate,
// LocalDate> {
// public void initialize(PastLocalDate past) {
// }
//
// public boolean isValid(LocalDate localDate,
// ConstraintValidatorContext context) {
// return localDate == null || localDate.isBefore(LocalDate.now());
// }
// }
//}
package com.mortals.xhx.utils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* @ClassName SpringUtils
* @Description TODO
* @Author finegirl
* @Date 2020/4/24 15:32
**/
@Component
public class SpringUtils implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringUtils.applicationContext = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
/**
* 对应的被管理类有别名时使用
* @param name
* @param <T>
* @return
* @throws BeansException
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) throws BeansException {
return (T) applicationContext.getBean(name);
}
/**
* 在对应的注解内未使用别名时 使用
*/
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
}
package com.mortals.xhx.utils;
import com.mortals.framework.util.DateUtils;
import java.text.SimpleDateFormat;
import java.util.*;
public class TimeUtil {
public static List<String> findDaysStr(String begintTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date dBegin = null;
Date dEnd = null;
try {
dBegin = sdf.parse(begintTime);
dEnd = sdf.parse(endTime);
} catch (Exception e) {
e.printStackTrace();
}
//存放每一天日期String对象的daysStrList
List<String> daysStrList = new ArrayList<String>();
//放入开始的那一天日期String
daysStrList.add(sdf.format(dBegin));
Calendar calBegin = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calBegin.setTime(dBegin);
Calendar calEnd = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calEnd.setTime(dEnd);
// 判断循环此日期是否在指定日期之后
while (dEnd.after(calBegin.getTime())) {
// 根据日历的规则,给定的日历字段增加或减去指定的时间量
calBegin.add(Calendar.DAY_OF_MONTH, 1);
String dayStr = sdf.format(calBegin.getTime());
daysStrList.add(dayStr);
}
return daysStrList;
}
public static List<String> findMonthsStr(String begintTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
Date dBegin = null;
Date dEnd = null;
try {
dBegin = sdf.parse(begintTime);
dEnd = sdf.parse(endTime);
} catch (Exception e) {
e.printStackTrace();
}
//存放每一天日期String对象的daysStrList
List<String> monthsStrList = new ArrayList<String>();
//放入开始的那一天的月份String
monthsStrList.add(sdf1.format(dBegin));
Calendar calBegin = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calBegin.setTime(dBegin);
Calendar calEnd = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calEnd.setTime(dEnd);
// 判断循环此日期是否在指定日期之后
while (dEnd.after(calBegin.getTime())) {
// 根据日历的规则,给定的日历字段增加或减去指定的时间量
calBegin.add(Calendar.MONTH, 1);
String dayStr = sdf1.format(calBegin.getTime());
monthsStrList.add(dayStr);
}
return monthsStrList;
}
public static List<String> findYearsStr(String begintTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
Date dBegin = null;
Date dEnd = null;
try {
dBegin = sdf.parse(begintTime);
dEnd = sdf.parse(endTime);
} catch (Exception e) {
e.printStackTrace();
}
List<String> yearsStrList = new ArrayList<String>();
yearsStrList.add(sdf.format(dBegin));
Calendar calBegin = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calBegin.setTime(dBegin);
Calendar calEnd = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calEnd.setTime(dEnd);
// 判断循环此日期是否在指定日期之后
while (dEnd.after(calBegin.getTime())) {
// 根据日历的规则,给定的日历字段增加或减去指定的时间量
calBegin.add(Calendar.YEAR, 1);
String dayStr = sdf.format(calBegin.getTime());
yearsStrList.add(dayStr);
}
return yearsStrList;
}
public static void main(String[] args) {
/* String begintTime = "2017";
String endTime = "2018";
// TimeUtil.findDaysStr(begintTime,endTime).stream().forEach(f->System.out.println(f));
//TimeUtil.findMonthsStr(begintTime,endTime).stream().forEach(f->System.out.println(f));
TimeUtil.findYearsStr(begintTime,endTime).stream().forEach(f->System.out.println(f));*/
/* String begintTime = "2017-03-01";
;
String yyyy = DateUtils.getDateTimeStr(DateUtils.StrToDateTime(begintTime, "yyyy"), DateUtils.P_yyyy_MM_dd);
System.out.println(yyyy);*/
String startTime="2019-03-18";
System.out.println(DateUtils.StrToDateTime(startTime,DateUtils.P_yyyy_MM_dd).getTime());
}
}
/**
* 文件:VersionEntity.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.version.model;
import java.util.Date;
import com.mortals.framework.model.BaseEntityLong;
/**
* <p>Title: 系统版本信息</p>
* <p>Description: VersionEntity </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class VersionEntity extends BaseEntityLong{
private static final long serialVersionUID = 1575265170865L;
/** 共享设备类型,1:按摩椅,2:充电宝,3:娱乐设备,4:共享雨伞,5:共享打印机,6:闪充 */
private Integer type;
/** 版本下载地址,当前版本下载地址,相对路径保存 */
private String downloadUrl;
/** 版本号,版本号 */
private String version;
/** 版本描述信息,描述信息 */
private String description;
/** 版本状态,0:停用,1:正常,默认1 */
private Integer versionStatus;
/** 创建用户ID */
private Long createUserId;
/** 创建用户名称 */
private String createUserName;
/** 创建时间 */
private Date createTime;
public VersionEntity(){
}
/**
* 获取 共享设备类型,1:按摩椅,2:充电宝,3:娱乐设备,4:共享雨伞,5:共享打印机,6:闪充
* @return type
*/
public Integer getType(){
return this.type;
}
/**
* 设置 共享设备类型,1:按摩椅,2:充电宝,3:娱乐设备,4:共享雨伞,5:共享打印机,6:闪充
* @param type
*/
public void setType(Integer type){
this.type = type;
}
/**
* 获取 版本下载地址,当前版本下载地址,相对路径保存
* @return downloadUrl
*/
public String getDownloadUrl(){
return this.downloadUrl;
}
/**
* 设置 版本下载地址,当前版本下载地址,相对路径保存
* @param downloadUrl
*/
public void setDownloadUrl(String downloadUrl){
this.downloadUrl = downloadUrl;
}
/**
* 获取 版本号,版本号
* @return version
*/
public String getVersion(){
return this.version;
}
/**
* 设置 版本号,版本号
* @param version
*/
public void setVersion(String version){
this.version = version;
}
/**
* 获取 版本描述信息,描述信息
* @return description
*/
public String getDescription(){
return this.description;
}
/**
* 设置 版本描述信息,描述信息
* @param description
*/
public void setDescription(String description){
this.description = description;
}
/**
* 获取 版本状态,0:停用,1:正常,默认1
* @return versionStatus
*/
public Integer getVersionStatus(){
return this.versionStatus;
}
/**
* 设置 版本状态,0:停用,1:正常,默认1
* @param versionStatus
*/
public void setVersionStatus(Integer versionStatus){
this.versionStatus = versionStatus;
}
/**
* 获取 创建用户ID
* @return createUserId
*/
public Long getCreateUserId(){
return this.createUserId;
}
/**
* 设置 创建用户ID
* @param createUserId
*/
public void setCreateUserId(Long createUserId){
this.createUserId = createUserId;
}
/**
* 获取 创建用户名称
* @return createUserName
*/
public String getCreateUserName(){
return this.createUserName;
}
/**
* 设置 创建用户名称
* @param createUserName
*/
public void setCreateUserName(String createUserName){
this.createUserName = createUserName;
}
/**
* 获取 创建时间
* @return createTime
*/
public Date getCreateTime(){
return this.createTime;
}
/**
* 设置 创建时间
* @param createTime
*/
public void setCreateTime(Date createTime){
this.createTime = createTime;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj instanceof VersionEntity) {
VersionEntity tmp = (VersionEntity) obj;
if (this.getId().longValue() == tmp.getId().longValue()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append("id:").append(getId())
.append(",type:").append(getType())
.append(",downloadUrl:").append(getDownloadUrl())
.append(",version:").append(getVersion())
.append(",description:").append(getDescription())
.append(",versionStatus:").append(getVersionStatus())
.append(",createUserId:").append(getCreateUserId())
.append(",createUserName:").append(getCreateUserName())
.append(",createTime:").append(getCreateTime());
return sb.toString();
}
public void initAttrValue(){
this.type = null;
this.downloadUrl = null;
this.version = null;
this.description = null;
this.versionStatus = 1;
this.createUserId = null;
this.createUserName = null;
this.createTime = null;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>dataCenter-handler</artifactId>
<packaging>jar</packaging>
<description>handler服务</description>
<parent>
<groupId>com.mortals.xhx</groupId>
<artifactId>xhx-base</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring.cloud.alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.mortals.xhx</groupId>
<artifactId>dataCenter-common-lib</artifactId>
</dependency>
<!-- 引入 SpringMVC 相关依赖,并实现对其的自动配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.20</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
#!/bin/sh
RETVAL=$?
. /etc/profile #加载环境变量(Jenkins远程启动程序报找不到Java文件问题,需加载环境变量)
export CATALINA_BASE="$PWD"
case "$1" in
start)
if [ -f $CATALINA_BASE/start.sh ];then
$CATALINA_BASE/start.sh 17022 &
fi
;;
stop)
if [ -f $CATALINA_BASE/stop.sh ];then
$CATALINA_BASE/stop.sh 17022
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL
\ No newline at end of file
#!/bin/sh
PORT=$1
BASEDIR=`dirname $0`/..
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@";
MAIN_CLASS="$PROJECT_NAME-@project.version@.jar";
ENCRYPT_KEY="foobar";
LOG_PATH="@profiles.log.path@/$PROJECT_NAME"
GC_PATH=$LOG_PATH/$PORT"-gc.log"
HS_ERR_PATH=$LOG_PATH/$PORT"-hs_err.log"
HEAP_DUMP_PATH=$LOG_PATH/$PORT"-heap_dump.hprof"
TEMP_PATH=$LOG_PATH/temp/
SUCCESS=0
FAIL=9
if [ ! -n "$PORT" ]; then
echo $"Usage: $0 {port}"
exit $FAIL
fi
if [ ! -d $LOG_PATH ];
then
mkdir -p $LOG_PATH;
fi
if [ ! -d $TEMP_PATH ];
then
mkdir -p $TEMP_PATH;
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=`which java > /dev/null 2>&1`
echo "Error: JAVA_HOME is not defined correctly."
exit $ERR_NO_JAVA
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "We cannot execute $JAVACMD"
exit $ERR_NO_JAVA
fi
if [ -e "$BASEDIR" ]
then
JAVA_OPTS="-Xms512M -Xmx1024M -Xss256K -XX:+UseAdaptiveSizePolicy -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:GCTimeRatio=39 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$GC_PATH -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=$HS_ERR_PATH -XX:HeapDumpPath=$HEAP_DUMP_PATH"
fi
CLASSPATH=$CLASSPATH_PREFIX:
EXTRA_JVM_ARGUMENTS=""
cd "$BASEDIR/boot";
echo "starting application $PROJECT_NAME......"
exec "$JAVACMD" $JAVA_OPTS \
$EXTRA_JVM_ARGUMENTS \
-Dapp.name="$PROJECT_NAME" \
-Dapp.port="$PORT" \
-Dbasedir="$BASEDIR" \
-Djava.io.tmpdir=$TEMP_PATH \
-Dloader.path="file://$BASEDIR/conf,file://$BASEDIR/lib" \
-jar $MAIN_CLASS \
--server.port="$PORT" \
--encrypt.key="$ENCRYPT_KEY" \
> /dev/null &
for i in {1..60}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
echo "The $PROJECT_NAME start finished, PID is $jcpid"
exit $SUCCESS
else
echo "starting the application .. $i"
sleep 1
fi
done
echo "$PROJECT_NAME start failure!"
\ No newline at end of file
#! /bin/sh
PORT=$1
BASEDIR=`dirname $0`
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@"
MAIN_CLASS="$PROJECT_NAME";
SECURITY_USERNAME="admin";
SECURITY_PASSWORD="1";
if [ ! -n "$PORT" ]; then
echo $"Usage: $0 {port}"
exit $FAIL
fi
echo "stoping application $PROJECT_NAME......"
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME is not started or has been stopped!"
else
curl -X POST -i -u $SECURITY_USERNAME:$SECURITY_PASSWORD http://127.0.0.1:$PORT/xxx_manager/shutdown
for i in {1..60}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -15 $jcpid
for i in {1..30}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
fi
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -9 $jcpid
[ $? -eq 0 ] && echo "Stop $PROJECT_NAME OK!" || echo "Stop $PROJECT_NAME Fail!"
fi
fi
\ No newline at end of file
package com.mortals.xhx;
import com.mortals.framework.springcloud.boot.BaseWebApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ImportResource;
@EnableFeignClients
@SpringBootApplication(scanBasePackages = { "com.mortals" })
@ServletComponentScan("com.mortals")
@ImportResource(locations = { "classpath:config/spring-config.xml" })
public class HandlerApplication extends BaseWebApplication {
public static void main(String[] args) {
SpringApplication.run(HandlerApplication.class, args);
}
}
package com.mortals.xhx.base.framework.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by chendilin on 2018/3/8.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Operlog {
String msg() default "";
String params() default "";
}
package com.mortals.xhx.base.framework.aspect;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.mortals.xhx.base.system.oper.service.OperLogService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.impl.FileLogServiceImpl;
/**
* 操作日志记录 Created by chendilin on 2018/3/8.
*/
@Component
// @Aspect
// @Component
public class OperlogAspect extends FileLogServiceImpl implements ILogService {
private final static Logger logger = LoggerFactory.getLogger(OperlogAspect.class);
@Autowired
private OperLogService operLogService;
@Override
public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl,
String content, String ip, Date logDate) {
super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate);
operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content);
}
@Override
public void doHandlerLog(String platformMark, String loginName, String requestUrl, String content, String ip) {
// operLogService.insertOperLog(ip, requestUrl, null, "", loginName,
// content);
this.doHandlerLog(platformMark, null, "", loginName, requestUrl, content, ip, new Date());
}
@Pointcut("execution(public * com.mortals.iot.module..*Controller.*(..))")
public void accessLog() {
}
@Before("accessLog()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// url
logger.info("ip[{}]url[{}]", request.getRemoteAddr(), request.getRequestURL());
// 参数 使用公司框架 第1和第2个参数为HttpServletRequest request, HttpServletResponse
// response
if (joinPoint.getArgs().length > 2) {
logger.info("args={}", joinPoint.getArgs()[2]);
} else {
logger.info("args={}", joinPoint.getArgs());
}
// logger.info("url={}", request.getRequestURL());
//
// // method
// logger.info("method={}", request.getMethod());
//
// // ip
// logger.info("ip={}", request.getRemoteAddr());
//
// // 类方法
// logger.info("class_method={}",
// joinPoint.getSignature().getDeclaringTypeName() + "." +
// joinPoint.getSignature().getName());
//
// // 参数
// logger.info("args={}", joinPoint.getArgs());
}
// @After("sign()")
// public void doAfter() {
// logger.info("222222222222");
// }
@AfterReturning(returning = "object", pointcut = "accessLog()")
public void doAfterReturning(Object object) {
if (null != object) {
logger.info("response={}", object.toString());
}
}
}
package com.mortals.xhx.base.framework.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import com.mortals.framework.web.config.BasePropertyPlaceholderConfigurer;
//@Configuration
public class IotServiceDataConfiguration {
@Bean
public PropertyPlaceholderConfigurer properties() {
BasePropertyPlaceholderConfigurer bppc = new BasePropertyPlaceholderConfigurer();
bppc.setIgnoreUnresolvablePlaceholders(true);
final List<Resource> resourceLst = new ArrayList<>();
resourceLst.add(new ClassPathResource("bootstrap.properties"));
bppc.setLocations(resourceLst.toArray(new Resource[] {}));
return bppc;
}
}
package com.mortals.xhx.base.framework.config;
import java.io.IOException;
import java.net.URLDecoder;
import javax.sql.DataSource;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ibatis.io.VFS;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import com.mortals.framework.springcloud.config.SpringBootVFS;
@Configuration
public class MybatisConfiguration {
private static Log logger = LogFactory.getLog(MybatisConfiguration.class);
// 配置类型别名
@Value("${spring.application.name}")
private String name;
// 配置类型别名
@Value("${mybatis.root-path}")
private String rootPath;
private static final String ROOT_PATH_SPLIT = ",";
// 配置类型别名
@Value("${mybatis.type-aliases-package}")
private String typeAliasesPackage;
// 配置mapper的扫描,找到所有的mapper.xml映射文件
@Value("${mybatis.mapper-locations}")
private String mapperLocations;
// 加载全局的配置文件
@Value("${mybatis.config-location}")
private String configLocation;
private final String PATH_SEPARATOR = "/";
// 提供SqlSeesion
@Bean(name = "sqlSessionFactory")
public SqlSessionFactory sqlSessionFactoryBean(@Qualifier("dataSource") DataSource dataSource) {
return getSqlSessionFactoryBean(dataSource);
}
public SqlSessionFactory getSqlSessionFactoryBean(DataSource dataSource) {
try {
// 解决myBatis下 不能从嵌套jar文件中读取class的问题
VFS.addImplClass(SpringBootVFS.class);
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
// 读取配置
sessionFactoryBean.setTypeAliasesPackage(getTypeAliasesPackage());
//
Resource[] resources = new PathMatchingResourcePatternResolver().getResources(mapperLocations);
sessionFactoryBean.setMapperLocations(resources);
// //
Resource[] configLocations = new PathMatchingResourcePatternResolver().getResources(configLocation);
sessionFactoryBean.setConfigLocation(configLocations[0]);
// 添加插件 (改为使用配置文件加载了)
// sqlSessionFactoryBean.setPlugins(new
// Interceptor[]{pageHelper()});
return sessionFactoryBean.getObject();
} catch (IOException e) {
logger.error("mybatis resolver mapper*xml is error", e);
return null;
} catch (Exception e) {
logger.error("mybatis sqlSessionFactoryBean create error", e);
return null;
}
}
public String getTypeAliasesPackage() {
if (StringUtils.isEmpty(typeAliasesPackage)) {
return "";
}
rootPath = rootPath.trim().replace(".", PATH_SEPARATOR);
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
StringBuffer typeAliasesPackageStringBuffer = new StringBuffer();
try {
for (String location : typeAliasesPackage.split(ROOT_PATH_SPLIT)) {
if (StringUtils.isEmpty(location)) {
continue;
}
if (location.contains("*")) {
location = "classpath*:" + location.trim().replace(".", PATH_SEPARATOR);
location = getResources(resolver, location);
}
if (location.endsWith(PATH_SEPARATOR)) {
location = location.substring(0, location.length() - 1);
}
typeAliasesPackageStringBuffer.append(location + ROOT_PATH_SPLIT);
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
if (typeAliasesPackageStringBuffer.length() == 0) {
throw new RuntimeException(
"mybatis typeAliasesPackage 路径扫描错误!请检查applicationContext.xml@sqlSessionFactory配置!");
}
String allTypeAliasesPackage = typeAliasesPackageStringBuffer.toString().replace(PATH_SEPARATOR, ".");
logger.info("allTypeAliasesPackage:" + allTypeAliasesPackage);
return allTypeAliasesPackage;
}
private String getResources(ResourcePatternResolver resolver, String location) throws IOException {
StringBuffer resourcePathStringBuffer = new StringBuffer();
for (Resource resource : resolver.getResources(location)) {
if (resource == null || resource.getURL() == null) {
continue;
}
String path = resource == null ? "" : resource.getURL().getPath();
path = URLDecoder.decode(path, "UTF-8");// 对URL进行解码
path = path.replaceAll("\\\\", PATH_SEPARATOR);// 将所有反斜杠(\)替换成正斜杠(/)
if (StringUtils.isEmpty(path) || path.indexOf(rootPath) == -1) {
continue;
}
if (path.endsWith(PATH_SEPARATOR)) {
path = path.substring(0, path.length() - 1);
}
resourcePathStringBuffer.append(path.substring(path.indexOf(rootPath))).append(ROOT_PATH_SPLIT);
}
return resourcePathStringBuffer.toString();
}
}
\ No newline at end of file
package com.mortals.xhx.base.framework.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
/**
* 统一异常处理
*/
@ControllerAdvice
public class ExceptionHandle {
private final static Logger log = LoggerFactory.getLogger(ExceptionHandle.class);
public static final String KEY_RESULT_CODE = "code";
public static final String KEY_RESULT_MSG = "msg";
public static final String KEY_RESULT_DATA = "data";
public static final int VALUE_RESULT_FAILURE = -1;
@ExceptionHandler(value = Exception.class)
@ResponseBody
public String handle(Exception e) {
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
if (e instanceof AppException) {
StackTraceElement stack = e.getStackTrace()[0];
log.error("[business error]=========stack message[{}],[{},method:{},line{}][{}]", e.getMessage(),
stack.getClassName(), stack.getMethodName(), stack.getLineNumber(), e.getClass().getName());
AppException ex = (AppException) e;
ret.put(KEY_RESULT_MSG, ex.getMessage());
} else {
log.error("[system error]{}", e);
ret.put(KEY_RESULT_MSG, "unknown exception!");
}
return ret.toJSONString();
}
}
package com.mortals.xhx.base.system.idgenerator.dao;
import com.mortals.xhx.base.system.idgenerator.model.IdgeneratorEntity;
import com.mortals.framework.dao.ICRUDDao;
/**
* <p>Title: id生成器</p>
* <p>Description: IdgeneratorDao DAO接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
*
* @author
* @version 1.0.0
*/
public interface IdgeneratorDao extends ICRUDDao<IdgeneratorEntity, Long> {
}
\ No newline at end of file
package com.mortals.xhx.base.system.idgenerator.dao.ibatis;
import com.mortals.xhx.base.system.idgenerator.dao.IdgeneratorDao;
import com.mortals.xhx.base.system.idgenerator.model.IdgeneratorEntity;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
/**
* <p>Title: id生成器</p>
* <p>Description: IdgeneratorDaoImpl DAO接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
*
* @author
* @version 1.0.0
*/
@Repository("idgeneratorDao")
public class IdgeneratorDaoImpl extends BaseCRUDDaoMybatis<IdgeneratorEntity, Long> implements IdgeneratorDao {
}
\ No newline at end of file
package com.mortals.xhx.base.system.idgenerator.model;
import com.mortals.framework.model.BaseEntityLong;
import java.util.Date;
/**
* <p>Title: id生成器</p>
* <p>Description: IdgeneratorEntity </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
*
* @author
* @version 1.0.0
*/
public class IdgeneratorEntity extends BaseEntityLong {
private static final long serialVersionUID = 1555564885341L;
/** id类型 */
private String idType;
/** 当前id最大值 */
private Long idMaxValue;
/** 备注 */
private String remark;
/** 版本号,默认0 */
private Long versionNum;
/** 最后修改时间 */
private Date gmtModify;
public IdgeneratorEntity() {
}
/**
* 获取 id类型
*
* @return idType
*/
public String getIdType() {
return this.idType;
}
/**
* 设置 id类型
*
* @param idType
*/
public void setIdType(String idType) {
this.idType = idType;
}
/**
* 获取 当前id最大值
*
* @return idMaxValue
*/
public Long getIdMaxValue() {
return this.idMaxValue;
}
/**
* 设置 当前id最大值
*
* @param idMaxValue
*/
public void setIdMaxValue(Long idMaxValue) {
this.idMaxValue = idMaxValue;
}
/**
* 获取 备注
*
* @return remark
*/
public String getRemark() {
return this.remark;
}
/**
* 设置 备注
*
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* 获取 版本号,默认0
*
* @return versionNum
*/
public Long getVersionNum() {
return this.versionNum;
}
/**
* 设置 版本号,默认0
*
* @param versionNum
*/
public void setVersionNum(Long versionNum) {
this.versionNum = versionNum;
}
/**
* 获取 最后修改时间
*
* @return gmtModify
*/
public Date getGmtModify() {
return this.gmtModify;
}
/**
* 设置 最后修改时间
*
* @param gmtModify
*/
public void setGmtModify(Date gmtModify) {
this.gmtModify = gmtModify;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj instanceof IdgeneratorEntity) {
IdgeneratorEntity tmp = (IdgeneratorEntity) obj;
return this.getId().longValue() == tmp.getId().longValue();
}
return false;
}
@Override
public String toString() {
return "IdgeneratorEntity{" + "idType='" + idType + '\'' + ", idMaxValue=" + idMaxValue + ", remark='" + remark
+ '\'' + ", versionNum=" + versionNum + ", gmtModify=" + gmtModify + ", id=" + id + '}';
}
@Override
public void initAttrValue() {
this.idType = null;
this.idMaxValue = null;
this.remark = null;
this.versionNum = 0L;
this.gmtModify = null;
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.idgenerator.model;
import java.util.List;
/**
* <p>Title: id生成器</p>
* <p>Description: IdgeneratorQuery </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
*
* @author
* @version 1.0.0
*/
public class IdgeneratorQuery extends IdgeneratorEntity {
private static final long serialVersionUID = 1555564885342L;
/** 开始 菜单ID,主键,自增长 */
private Long idStart;
/** 结束 菜单ID,主键,自增长 */
private Long idEnd;
/** 增加 菜单ID,主键,自增长 */
private Long idIncrement;
/** 菜单ID,主键,自增长 */
private List<Long> idList;
/** id类型 */
private List<String> idTypeList;
/** 开始 当前id最大值 */
private Long idMaxValueStart;
/** 结束 当前id最大值 */
private Long idMaxValueEnd;
/** 增加 当前id最大值 */
private Long idMaxValueIncrement;
/** 当前id最大值 */
private List<Long> idMaxValueList;
/** 备注 */
private List<String> remarkList;
/** 开始 版本号,默认0 */
private Long versionNumStart;
/** 结束 版本号,默认0 */
private Long versionNumEnd;
/** 增加 版本号,默认0 */
private Long versionNumIncrement;
/** 版本号,默认0 */
private List<Long> versionNumList;
/** 开始 最后修改时间 */
private String gmtModifyStart;
/** 结束 最后修改时间 */
private String gmtModifyEnd;
public IdgeneratorQuery() {
}
/**
* 获取 开始 菜单ID,主键,自增长
*
* @return idStart
*/
public Long getIdStart() {
return this.idStart;
}
/**
* 设置 开始 菜单ID,主键,自增长
*
* @param idStart
*/
public void setIdStart(Long idStart) {
this.idStart = idStart;
}
/**
* 获取 结束 菜单ID,主键,自增长
*
* @return idEnd
*/
public Long getIdEnd() {
return this.idEnd;
}
/**
* 设置 结束 菜单ID,主键,自增长
*
* @param idEnd
*/
public void setIdEnd(Long idEnd) {
this.idEnd = idEnd;
}
/**
* 获取 增加 菜单ID,主键,自增长
*
* @return idIncrement
*/
public Long getIdIncrement() {
return this.idIncrement;
}
/**
* 设置 增加 菜单ID,主键,自增长
*
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement) {
this.idIncrement = idIncrement;
}
/**
* 获取 菜单ID,主键,自增长
*
* @return idList
*/
public List<Long> getIdList() {
return this.idList;
}
/**
* 设置 菜单ID,主键,自增长
*
* @param idList
*/
public void setIdList(List<Long> idList) {
this.idList = idList;
}
/**
* 获取 id类型
*
* @return idTypeList
*/
public List<String> getIdTypeList() {
return this.idTypeList;
}
/**
* 设置 id类型
*
* @param idTypeList
*/
public void setIdTypeList(List<String> idTypeList) {
this.idTypeList = idTypeList;
}
/**
* 获取 开始 当前id最大值
*
* @return idMaxValueStart
*/
public Long getIdMaxValueStart() {
return this.idMaxValueStart;
}
/**
* 设置 开始 当前id最大值
*
* @param idMaxValueStart
*/
public void setIdMaxValueStart(Long idMaxValueStart) {
this.idMaxValueStart = idMaxValueStart;
}
/**
* 获取 结束 当前id最大值
*
* @return idMaxValueEnd
*/
public Long getIdMaxValueEnd() {
return this.idMaxValueEnd;
}
/**
* 设置 结束 当前id最大值
*
* @param idMaxValueEnd
*/
public void setIdMaxValueEnd(Long idMaxValueEnd) {
this.idMaxValueEnd = idMaxValueEnd;
}
/**
* 获取 增加 当前id最大值
*
* @return idMaxValueIncrement
*/
public Long getIdMaxValueIncrement() {
return this.idMaxValueIncrement;
}
/**
* 设置 增加 当前id最大值
*
* @param idMaxValueIncrement
*/
public void setIdMaxValueIncrement(Long idMaxValueIncrement) {
this.idMaxValueIncrement = idMaxValueIncrement;
}
/**
* 获取 当前id最大值
*
* @return idMaxValueList
*/
public List<Long> getIdMaxValueList() {
return this.idMaxValueList;
}
/**
* 设置 当前id最大值
*
* @param idMaxValueList
*/
public void setIdMaxValueList(List<Long> idMaxValueList) {
this.idMaxValueList = idMaxValueList;
}
/**
* 获取 备注
*
* @return remarkList
*/
public List<String> getRemarkList() {
return this.remarkList;
}
/**
* 设置 备注
*
* @param remarkList
*/
public void setRemarkList(List<String> remarkList) {
this.remarkList = remarkList;
}
/**
* 获取 开始 版本号,默认0
*
* @return versionNumStart
*/
public Long getVersionNumStart() {
return this.versionNumStart;
}
/**
* 设置 开始 版本号,默认0
*
* @param versionNumStart
*/
public void setVersionNumStart(Long versionNumStart) {
this.versionNumStart = versionNumStart;
}
/**
* 获取 结束 版本号,默认0
*
* @return versionNumEnd
*/
public Long getVersionNumEnd() {
return this.versionNumEnd;
}
/**
* 设置 结束 版本号,默认0
*
* @param versionNumEnd
*/
public void setVersionNumEnd(Long versionNumEnd) {
this.versionNumEnd = versionNumEnd;
}
/**
* 获取 增加 版本号,默认0
*
* @return versionNumIncrement
*/
public Long getVersionNumIncrement() {
return this.versionNumIncrement;
}
/**
* 设置 增加 版本号,默认0
*
* @param versionNumIncrement
*/
public void setVersionNumIncrement(Long versionNumIncrement) {
this.versionNumIncrement = versionNumIncrement;
}
/**
* 获取 版本号,默认0
*
* @return versionNumList
*/
public List<Long> getVersionNumList() {
return this.versionNumList;
}
/**
* 设置 版本号,默认0
*
* @param versionNumList
*/
public void setVersionNumList(List<Long> versionNumList) {
this.versionNumList = versionNumList;
}
/**
* 获取 开始 最后修改时间
*
* @return gmtModifyStart
*/
public String getGmtModifyStart() {
return this.gmtModifyStart;
}
/**
* 设置 开始 最后修改时间
*
* @param gmtModifyStart
*/
public void setGmtModifyStart(String gmtModifyStart) {
this.gmtModifyStart = gmtModifyStart;
}
/**
* 获取 结束 最后修改时间
*
* @return gmtModifyEnd
*/
public String getGmtModifyEnd() {
return this.gmtModifyEnd;
}
/**
* 设置 结束 最后修改时间
*
* @param gmtModifyEnd
*/
public void setGmtModifyEnd(String gmtModifyEnd) {
this.gmtModifyEnd = gmtModifyEnd;
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.idgenerator.service;
import com.mortals.xhx.base.system.idgenerator.service.impl.IdgeneratorServiceImpl;
import java.util.List;
/**
* <p>Title: id生成器</p>
* <p>Description: IdgeneratorService service接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
*
* @author
* @version 1.0.0
*/
public interface IdgeneratorService {
/**
* 获取Long类型ID
*
* @param idGeneratorKey
* @param factorInfo 生成因子,根据各IdGeneratorKey要求选择传入
* @return
* @createTime 2016年3月16日 上午10:43:22
*/
Long getLongId(IdgeneratorServiceImpl.IdGeneratorKey idGeneratorKey, Object... factorInfo);
/**
* 获取String类型ID
*
* @param idGeneratorKey
* @param factorInfo 生成因子,根据各IdGeneratorKey要求选择传入
* @return
* @createTime 2016年3月16日 上午10:43:38
*/
String getStringId(IdgeneratorServiceImpl.IdGeneratorKey idGeneratorKey, Object... factorInfo);
/**
* 批量获取Long类型ID
*
* @param idGeneratorKey
* @param factorInfo
* @return
*/
List<Long> getLongIdList(IdgeneratorServiceImpl.IdGeneratorKey idGeneratorKey, Object... factorInfo);
}
\ No newline at end of file
/**
* 文件:OperLogDao.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.oper.dao;
import com.mortals.xhx.base.system.oper.model.OperLogEntity;
import com.mortals.framework.dao.ICRUDDao;
/**
* <p>Title: 操作日志</p>
* <p>Description: OperLogDao DAO接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public interface OperLogDao extends ICRUDDao<OperLogEntity,Long> {
}
\ No newline at end of file
/**
* 文件:OperLogDaoImpl.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.oper.dao.ibatis;
import com.mortals.xhx.base.system.oper.dao.OperLogDao;
import com.mortals.xhx.base.system.oper.model.OperLogEntity;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
/**
* <p>Title: 操作日志</p>
* <p>Description: OperLogDaoImpl DAO接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
@Repository("operLogDao")
public class OperLogDaoImpl extends BaseCRUDDaoMybatis<OperLogEntity,Long> implements OperLogDao {
}
\ No newline at end of file
package com.mortals.xhx.common.key;
public final class Constant {
/**
* 基础代码版本 Z-BASE.MANAGER-S1.0.0
*/
public final static String BASEMANAGER_VERSION = "Z-BASE.MANAGER-S1.0.0";
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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