diff --git a/tamguo-modules-core/pom.xml b/tamguo-modules-core/pom.xml index eee8ae4..e3427ba 100644 --- a/tamguo-modules-core/pom.xml +++ b/tamguo-modules-core/pom.xml @@ -5,13 +5,7 @@ com.tamguo tamguo-modules-core 1.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - - - + UTF-8 1.8 @@ -19,18 +13,6 @@ - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-jdbc - com.baomidou @@ -44,117 +26,30 @@ - - net.sourceforge.nekohtml - nekohtml - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-starter-redis - 1.3.8.RELEASE - - - org.springframework.session - spring-session-data-redis - com.alibaba fastjson 1.2.32 - org.apache.shiro - shiro-spring - 1.2.5 - - - org.apache.shiro - shiro-ehcache - 1.2.5 - - - cn.songxinqiang - com.baidu.ueditor - 1.1.2-edit-1.0 - - - commons-codec - commons-codec - - - commons-fileupload - commons-fileupload - 1.3.1 - - - commons-io - commons-io - - - com.alibaba - druid - 1.0.18 - - - mysql - mysql-connector-java - - - org.apache.commons - commons-lang3 - - - com.aliyun - aliyun-java-sdk-dysmsapi + com.tamguo + tamguo-common 1.0.0 - - com.aliyun - aliyun-java-sdk-core - 3.2.8 - - - org.apache.commons - commons-email - 1.5 - - - com.github.theborakompanioni - thymeleaf-extras-shiro - 1.2.1 - - - - com.bladejava - blade-patchca - 1.0.5 - - - - - org.springframework.cloud - spring-cloud-dependencies - Camden.SR6 - pom - import - - - - - oms + tamguo-modules-core - - org.springframework.boot - spring-boot-maven-plugin - - + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + \ No newline at end of file diff --git a/tamguo-modules-core/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java b/tamguo-modules-core/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java deleted file mode 100644 index d5ef840..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.tamguo.config.dao; - -import com.baomidou.mybatisplus.mapper.MetaObjectHandler; -import com.tamguo.modules.sys.utils.ShiroUtils; - -import org.apache.ibatis.reflection.MetaObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 注入公共字段自动填充,任选注入方式即可 - */ -//@Component -public class MyMetaObjectHandler extends MetaObjectHandler { - - protected final static Logger logger = LoggerFactory.getLogger(MyMetaObjectHandler.class); - - @Override - public void insertFill(MetaObject metaObject) { - Object testType = getFieldValByName("createBy", metaObject); - if (testType == null) { - setFieldValByName("createBy", ShiroUtils.getUser() , metaObject); //mybatis-plus版本2.0.9+ - } - } - - @Override - public void updateFill(MetaObject metaObject) { - logger.info("更新的时候干点不可描述的事情"); - } -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/config/dao/MybatisPlusConfig.java b/tamguo-modules-core/src/main/java/com/tamguo/config/dao/MybatisPlusConfig.java deleted file mode 100644 index 47d0386..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/config/dao/MybatisPlusConfig.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.tamguo.config.dao; - -import java.util.ArrayList; -import java.util.List; - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.baomidou.mybatisplus.mapper.ISqlInjector; -import com.baomidou.mybatisplus.mapper.LogicSqlInjector; -import com.baomidou.mybatisplus.mapper.MetaObjectHandler; -import com.baomidou.mybatisplus.plugins.PaginationInterceptor; -import com.baomidou.mybatisplus.plugins.PerformanceInterceptor; -import com.baomidou.mybatisplus.plugins.parser.ISqlParser; -import com.baomidou.mybatisplus.plugins.parser.tenant.TenantHandler; -import com.baomidou.mybatisplus.plugins.parser.tenant.TenantSqlParser; - -import net.sf.jsqlparser.expression.Expression; -import net.sf.jsqlparser.expression.LongValue; - -@Configuration -@MapperScan("com.tamguo.modules.*.dao*") -public class MybatisPlusConfig { - - @Bean - public PerformanceInterceptor performanceInterceptor() { - return new PerformanceInterceptor(); - } - - /** - * mybatis-plus分页插件
- * 文档:http://mp.baomidou.com
- */ - @Bean - public PaginationInterceptor paginationInterceptor() { - PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); - paginationInterceptor.setLocalPage(true);// 开启 PageHelper 的支持 - /* - * 【测试多租户】 SQL 解析处理拦截器
- * 这里固定写成住户 1 实际情况你可以从cookie读取,因此数据看不到 【 麻花藤 】 这条记录( 注意观察 SQL )
- */ - List sqlParserList = new ArrayList<>(); - TenantSqlParser tenantSqlParser = new TenantSqlParser(); - tenantSqlParser.setTenantHandler(new TenantHandler() { - @Override - public Expression getTenantId() { - return new LongValue(1L); - } - - @Override - public String getTenantIdColumn() { - return "course_id"; - } - - @Override - public boolean doTableFilter(String tableName) { - // 这里可以判断是否过滤表 - return true; - } - }); - - - sqlParserList.add(tenantSqlParser); - paginationInterceptor.setSqlParserList(sqlParserList); - // 以下过滤方式与 @SqlParser(filter = true) 注解等效 -// paginationInterceptor.setSqlParserFilter(new ISqlParserFilter() { -// @Override -// public boolean doFilter(MetaObject metaObject) { -// MappedStatement ms = PluginUtils.getMappedStatement(metaObject); -// // 过滤自定义查询此时无租户信息约束【 麻花藤 】出现 -// if ("com.baomidou.springboot.mapper.UserMapper.selectListBySQL".equals(ms.getId())) { -// return true; -// } -// return false; -// } -// }); - return paginationInterceptor; - } - - @Bean - public MetaObjectHandler metaObjectHandler(){ - return new MyMetaObjectHandler(); - } - - /** - * 注入sql注入器 - */ - @Bean - public ISqlInjector sqlInjector(){ - return new LogicSqlInjector(); - } -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysAreaEntity.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysAreaEntity.java index 9f0228f..d234c78 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysAreaEntity.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysAreaEntity.java @@ -4,8 +4,11 @@ import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; +import com.alibaba.fastjson.annotation.JSONField; +import com.alibaba.fastjson.serializer.SerializerFeature; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; +import com.tamguo.modules.sys.model.enums.SysAreaStatusEnum; /** @@ -15,6 +18,10 @@ import com.baomidou.mybatisplus.annotations.TableName; @TableName(value="sys_area") public class SysAreaEntity implements Serializable { private static final long serialVersionUID = 1L; + + public static final String ROOT_AREA_CODE = "0"; + public static final String TREE_CODE_AREA_SEPARATE = ","; + public static final String TREE_NAME_AREA_SEPARATE = "/"; @TableId private String areaCode; @@ -25,7 +32,10 @@ public class SysAreaEntity implements Serializable { private String parentCode; private String parentCodes; private String remarks; - private String status; + + @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString) + private SysAreaStatusEnum status; + private Boolean treeLeaf; private BigDecimal treeLevel; private String treeNames; @@ -101,14 +111,6 @@ public class SysAreaEntity implements Serializable { this.remarks = remarks; } - public String getStatus() { - return this.status; - } - - public void setStatus(String status) { - this.status = status; - } - public BigDecimal getTreeLevel() { return this.treeLevel; } @@ -168,4 +170,12 @@ public class SysAreaEntity implements Serializable { public void setTreeLeaf(Boolean treeLeaf) { this.treeLeaf = treeLeaf; } + + public SysAreaStatusEnum getStatus() { + return status; + } + + public void setStatus(SysAreaStatusEnum status) { + this.status = status; + } } \ No newline at end of file diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysUserEntity.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysUserEntity.java index 5bf0791..928536c 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysUserEntity.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/SysUserEntity.java @@ -7,6 +7,7 @@ import java.util.List; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.serializer.SerializerFeature; +import com.baomidou.mybatisplus.activerecord.Model; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; @@ -20,7 +21,7 @@ import com.tamguo.modules.sys.model.enums.SysUserTypeEnum; * */ @TableName(value="sys_user") -public class SysUserEntity implements Serializable { +public class SysUserEntity extends Model implements Serializable { private static final long serialVersionUID = 1L; @TableId @@ -477,5 +478,10 @@ public class SysUserEntity implements Serializable { this.userDataScopeListJson = userDataScopeListJson; } + @Override + protected Serializable pkVal() { + return getUserCode(); + } + } \ No newline at end of file diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysMenuCondition.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysMenuCondition.java index e3902c4..38a6565 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysMenuCondition.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysMenuCondition.java @@ -1,6 +1,8 @@ package com.tamguo.modules.sys.model.condition; public class SysMenuCondition { + + private String parentCode; private Integer pageNo; private Integer pageSize; @@ -17,5 +19,11 @@ public class SysMenuCondition { public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } + public String getParentCode() { + return parentCode; + } + public void setParentCode(String parentCode) { + this.parentCode = parentCode; + } } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysUserCondition.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysUserCondition.java index 4299d6b..a87e171 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysUserCondition.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/condition/SysUserCondition.java @@ -18,6 +18,7 @@ public class SysUserCondition { private String postCode; private String status; private String userType; + private String mgrType; private String orderBy; @@ -117,5 +118,11 @@ public class SysUserCondition { public void setOrderBy(String orderBy) { this.orderBy = orderBy; } + public String getMgrType() { + return mgrType; + } + public void setMgrType(String mgrType) { + this.mgrType = mgrType; + } } diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysAreaStatusEnum.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/enums/SysAreaStatusEnum.java similarity index 100% rename from tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysAreaStatusEnum.java rename to tamguo-modules-core/src/main/java/com/tamguo/modules/sys/model/enums/SysAreaStatusEnum.java diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysAreaService.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysAreaService.java index 0664de0..f2c789c 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysAreaService.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysAreaService.java @@ -13,4 +13,10 @@ public interface ISysAreaService extends IService{ JSONArray treeData(String excludeId); + /** 保存地区*/ + void save(SysAreaEntity area); + + /** 修改地区*/ + void update(SysAreaEntity area); + } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysRoleService.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysRoleService.java index 7fe192f..67dc6d3 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysRoleService.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysRoleService.java @@ -1,8 +1,7 @@ package com.tamguo.modules.sys.service; -import java.util.List; import java.util.Map; - +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.IService; import com.tamguo.modules.sys.model.SysRoleEntity; @@ -23,6 +22,12 @@ public interface ISysRoleService extends IService{ void allowDataScope(SysRoleEntity role); /** 角色树形结构*/ - List treeDate(String userType); + JSONArray treeDate(String userType); + + /** 修改角色*/ + void update(SysRoleEntity role); + + /** 新增角色*/ + void save(SysRoleEntity role); } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysUserService.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysUserService.java index 7df970f..0956e35 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysUserService.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/ISysUserService.java @@ -1,14 +1,15 @@ package com.tamguo.modules.sys.service; import java.util.List; - import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.IService; +import com.tamguo.common.utils.Result; +import com.tamguo.modules.sys.model.SysMenuEntity; import com.tamguo.modules.sys.model.SysUserDataScopeEntity; import com.tamguo.modules.sys.model.SysUserEntity; import com.tamguo.modules.sys.model.SysUserRoleEntity; import com.tamguo.modules.sys.model.condition.SysUserCondition; -import com.tamguo.modules.sys.utils.Result; +import com.tamguo.modules.sys.model.enums.SysUserMgrTypeEnum; public interface ISysUserService extends IService{ @@ -39,6 +40,9 @@ public interface ISysUserService extends IService{ /** 保存用户数据权限*/ public void saveUserDataScope(SysUserEntity user); + + /** 保存用户数据权限*/ + public void saveUserDataScope(SysUserEntity user , SysUserMgrTypeEnum mgrType); /** 停用账号*/ public Result disable(String userCode); @@ -48,4 +52,13 @@ public interface ISysUserService extends IService{ /** 删除用户*/ public Result delete(String userCode); + + /** 添加管理员*/ + public void saveAdmin(SysUserEntity user); + + /** 修改管理员*/ + public void updateAdmin(SysUserEntity user); + + /** 当前用户权限菜单*/ + public List findUserMenuList(String userCode); } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysAreaServiceImpl.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysAreaServiceImpl.java index 075068d..0b7403e 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysAreaServiceImpl.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysAreaServiceImpl.java @@ -1,8 +1,11 @@ package com.tamguo.modules.sys.service.impl; +import java.math.BigDecimal; +import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.alibaba.fastjson.JSONArray; @@ -12,6 +15,7 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.tamguo.modules.sys.dao.SysAreaMapper; import com.tamguo.modules.sys.model.SysAreaEntity; import com.tamguo.modules.sys.model.condition.SysAreaCondition; +import com.tamguo.modules.sys.model.enums.SysAreaStatusEnum; import com.tamguo.modules.sys.service.ISysAreaService; @Service @@ -54,4 +58,77 @@ public class SysAreaServiceImpl extends ServiceImpl 0) { + area.setTreeLeaf(false); + }else { + area.setTreeLeaf(true); + } + return area; + } + + @SuppressWarnings("unchecked") + @Transactional(readOnly=false) + @Override + public void update(SysAreaEntity area) { + SysAreaEntity entity = sysAreaMapper.selectById(area.getAreaCode()); + + String oldParentCode = entity.getParentCode(); + + entity.setUpdateDate(new Date()); + entity.setParentCode(area.getParentCode()); + entity.setAreaName(area.getAreaName()); + entity.setAreaType(area.getAreaType()); + entity.setTreeSort(area.getTreeSort()); + entity.setRemarks(area.getRemarks()); + + this.handleTreeData(area); + sysAreaMapper.updateById(entity); + + // 更新旧的节点 + Integer count = sysAreaMapper.selectCount(Condition.create().eq("parent_code", oldParentCode).ne("area_code", oldParentCode)); + if(count == 0) { + SysAreaEntity oldParentOffice = sysAreaMapper.selectById(oldParentCode); + oldParentOffice.setTreeLeaf(true); + sysAreaMapper.updateById(oldParentOffice); + } + } } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java index 78cf5e6..c82b345 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java @@ -17,7 +17,6 @@ import com.tamguo.modules.sys.dao.SysCompanyMapper; import com.tamguo.modules.sys.model.SysCompanyEntity; import com.tamguo.modules.sys.model.condition.SysCompanyCondition; import com.tamguo.modules.sys.service.ISysCompanyService; -import com.tamguo.modules.sys.utils.ShiroUtils; @Service public class SysCompanyServiceImpl extends ServiceImpl implements ISysCompanyService { @@ -69,9 +68,7 @@ public class SysCompanyServiceImpl extends ServiceImpl implements ISysMenuService { @@ -64,28 +63,10 @@ public class SysMenuServiceImpl extends ServiceImpl implements ISysOfficeService { @@ -62,9 +61,7 @@ public class SysOfficeServiceImpl extends ServiceImpl implements ISysPostService{ @@ -31,8 +29,6 @@ public class SysPostServiceImpl extends ServiceImpl treeDate(String userType) { - return sysRoleMapper.selectList(Condition.create().eq("user_type", userType)); + public JSONArray treeDate(String userType) { + if(StringUtils.isEmpty(userType)) { + return this.transformTreeDate(sysRoleMapper.selectList(Condition.create().eq("is_sys", "0"))); + } + return this.transformTreeDate(sysRoleMapper.selectList(Condition.create().eq("is_sys", "0").eq("user_type", userType))); + } + + private JSONArray transformTreeDate(List roles) { + if(roles != null) { + JSONArray entitys = new JSONArray(); + for(int i=0 ; i implements ISysUserService{ @@ -45,6 +51,10 @@ public class SysUserServiceImpl extends ServiceImpl findUserMenuList(String userCode) { + if(SystemConstant.SYSTEM_USER_CODE.equals(userCode)) { + List menus = sysMenuMapper.selectList(Condition.create().orderAsc(java.util.Arrays.asList("tree_sort"))); + return (menus); + } + List menus = new ArrayList<>(); + Set menuIds = new HashSet<>(); + List userRoleList = sysUserRoleMapper.selectList(Condition.create().eq("user_code", userCode)); + for(SysUserRoleEntity userRole : userRoleList) { + List roleMenuList = sysRoleMenuMapper.selectList(Condition.create().eq("role_code", userRole.getRoleCode())); + for(SysRoleMenuEntity roleMenu : roleMenuList) { + SysMenuEntity menu = sysMenuMapper.selectById(roleMenu.getMenuCode()); + if(!menuIds.contains(menu.getMenuCode())) { + menus.add(menu); + } + menuIds.add(menu.getMenuCode()); + } + } + return menus; + } + } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/AbstractRunningLogHandler.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/AbstractRunningLogHandler.java deleted file mode 100644 index cfda82b..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/AbstractRunningLogHandler.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.InterruptedIOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -public abstract class AbstractRunningLogHandler implements LogHandler { - - private static Method getStackTraceMethod; - private static Method getClassNameMethod; - private static Method getMethodNameMethod; - private static Method getFileNameMethod; - private static Method getLineNumberMethod; - - static { - try { - Class[] noArgs = null; - getStackTraceMethod = Throwable.class.getMethod("getStackTrace", noArgs); - Class stackTraceElementClass = Class.forName("java.lang.StackTraceElement"); - getClassNameMethod = stackTraceElementClass.getMethod("getClassName", noArgs); - getMethodNameMethod = stackTraceElementClass.getMethod("getMethodName", noArgs); - getFileNameMethod = stackTraceElementClass.getMethod("getFileName", noArgs); - getLineNumberMethod = stackTraceElementClass.getMethod("getLineNumber", noArgs); - } catch (ClassNotFoundException ex) { - LogDebug.debug("will use pre-JDK 1.4 methods to determine location."); - } catch (NoSuchMethodException ex) { - LogDebug.debug("will use pre-JDK 1.4 methods to determine location."); - } - } - - /** - * 获得指定class的StackTraceElement - * - * @param t - * @param fqnOfCallingClass - * - * @return - */ - protected StackTraceElement getRunningStackTrace(Throwable t, String fqnOfCallingClass) { - if (getLineNumberMethod != null) { - try { - Object[] noArgs = null; - Object[] elements = (Object[]) getStackTraceMethod.invoke(t, noArgs); - for (int i = elements.length - 1; i >= 0; i--) { - String thisClass = (String) getClassNameMethod.invoke(elements[i], noArgs); - if (fqnOfCallingClass.equals(thisClass)) { - // 执行class名称 - String className = fqnOfCallingClass; - // 执行方法名称 - String methodName = (String) getMethodNameMethod.invoke(elements[i], noArgs); - // 执行class文件名称 - String fileName = (String) getFileNameMethod.invoke(elements[i], noArgs); - // 执行到行号 - int lineNumber = ((Integer) getLineNumberMethod.invoke(elements[i], noArgs)).intValue(); - return new StackTraceElement(className, methodName, fileName, lineNumber); - } - } - } catch (IllegalAccessException ex) { - LogDebug.debug("failed using JDK 1.4 methods", ex); - } catch (InvocationTargetException ex) { - if (ex.getTargetException() instanceof InterruptedException - || ex.getTargetException() instanceof InterruptedIOException) { - Thread.currentThread().interrupt(); - } - LogDebug.debug("failed using JDK 1.4 methods", ex); - } catch (RuntimeException ex) { - LogDebug.debug("failed using JDK 1.4 methods", ex); - } - } - return this.createDefaultStackTrace(); - } - - /** - * 创建默认StackTraceElement - * - * @return - */ - private StackTraceElement createDefaultStackTrace() { - return new StackTraceElement(this.getClass().getName(), "log", this.getClass().getName(), 0); - } - - @Override - public void info(String msg, String fqnOfCallingClass) { - } - - @Override - public void info(String msg, Throwable t, String fqnOfCallingClass) { - } - - @Override - public void error(String msg, String fqnOfCallingClass) { - } - - @Override - public void error(String msg, Throwable t, String fqnOfCallingClass) { - } - - @Override - public void debug(String msg, String fqnOfCallingClass) { - } - - @Override - public void debug(String msg, Throwable t, String fqnOfCallingClass) { - } - - @Override - public void warning(String msg, String fqnOfCallingClass) { - } - - @Override - public void warning(String msg, Throwable t, String fqnOfCallingClass) { - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/CException.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/CException.java deleted file mode 100644 index f06ed68..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/CException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class CException extends RuntimeException { - - private static final long serialVersionUID = 6401592364022805815L; - - public CException() { - super(); - } - - public CException(String message, Throwable cause) { - super(message, cause); - } - - public CException(String message) { - super(message); - } - - public CException(Throwable cause) { - super(cause); - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/DateUtil.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/DateUtil.java deleted file mode 100644 index 6ecf88c..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/DateUtil.java +++ /dev/null @@ -1,524 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -public final class DateUtil { - - /** - * 正常日期格式化模板. - */ - private static final SimpleDateFormat NORMAL_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - private static final SimpleDateFormat NORMAL_DATE_FORMAT_YY_MM_DD = new SimpleDateFormat("yyyy-MM-dd"); - private static final SimpleDateFormat NORMAL_DATE_FORMAT_YY_MM_DD_ = new SimpleDateFormat("yyyyMMdd"); - - private static final SimpleDateFormat NORMAL_DATE_FORMAT_YYMMDDHHMISS = new SimpleDateFormat("yyyyMMddHHmmss"); - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24) - */ - public static String dateFormatYYMMDD(long date) { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date(date * 1000)); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(20111124) - */ - - public static String getCurrentDateStr() { - return NORMAL_DATE_FORMAT_YY_MM_DD_.format(new Date()); - } - - public static String getCurrentDateYYYYMMDDStr() { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date()); - } - - public static String getNextDayYYYYMMDDStr() { - Calendar cal = Calendar.getInstance(); - try { - cal.setTime(NORMAL_DATE_FORMAT_YY_MM_DD.parse(getCurrentTime())); - cal.add(Calendar.DATE, 1); - return NORMAL_DATE_FORMAT_YY_MM_DD.format(cal.getTime()); - } catch (ParseException e) { - e.printStackTrace(); - } - return null; - } - - public static long getNextDayYYYYMMDDLong() { - Calendar cal = Calendar.getInstance(); - try { - cal.setTime(NORMAL_DATE_FORMAT_YY_MM_DD.parse(getCurrentTime())); - cal.add(Calendar.DATE, 1); - return cal.getTimeInMillis(); - } catch (ParseException e) { - e.printStackTrace(); - } - return 0l; - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24 16:46:38) - */ - public static String dateFormat(long date) { - return NORMAL_DATE_FORMAT.format(new Date(date * 1000)); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24) - */ - public static String dateFormatYYYYMMDD(long date) { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date(date * 1000)); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24 16:46:38) - */ - - public static String dateFormat(Date date) { - return NORMAL_DATE_FORMAT.format(date); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(20111124164638) - */ - - public static String dateFormathhmmss(Date date) { - return NORMAL_DATE_FORMAT_YYMMDDHHMISS.format(date); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(20111124164638) - */ - - public static String dateFormatYYYYMMDD(Date date) { - return NORMAL_DATE_FORMAT_YY_MM_DD_.format(date); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24 16:46:38) - */ - - public static String getCurrentTime() { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date()); - } - - /** - * 获取当前距1970年1月1日秒数. - * - * @return 当前距1970年1月1日秒数. - */ - public static Long getTime() { - return new Date().getTime() / 1000; - } - - /** - * 获取当前距1970年1月1日秒数. - * - * @return 获取最近一周的秒数. - */ - public static long getLastWeekTime() { - return new Date().getTime() / 1000 - 7 * 24 * 60 * 60; - } - - /** - * 获取当前距1970年1月1日秒数. - * - * @return 获取最近一个月的秒数. - */ - public static long getLastMonthTime() { - return new Date().getTime() / 1000 - 30 * 24 * 60 * 60; - } - - /** - * 获取某年某月第一天. - * - * @return 日期格式如:2011-12-31 00:00:00 . - */ - public static long getFirstDayOfMonth(String year, String month) { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.YEAR, Integer.valueOf(year)); - cal.set(Calendar.MONTH, Integer.valueOf(month) - 1); - cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DATE)); - return parseDate(NORMAL_DATE_FORMAT_YY_MM_DD.format(cal.getTime()) + " 00:00:00").getTime() / 1000; - } - - /** - * 获取某年某月最后一天. - * - * @return 日期格式如:2011-12-31 23:59:59 . - */ - public static long getLastDayOfMonth(String year, String month) { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.YEAR, Integer.valueOf(year)); - cal.set(Calendar.MONTH, Integer.valueOf(month) - 1); - cal.set(Calendar.DAY_OF_MONTH, 1); - int value = cal.getActualMaximum(Calendar.DAY_OF_MONTH); - cal.set(Calendar.DAY_OF_MONTH, value); - return parseDate(NORMAL_DATE_FORMAT_YY_MM_DD.format(cal.getTime()) + " 23:59:59").getTime() / 1000; - } - - /** - * 解析字符串为Date. - * - * @param dateString - * 日期字符串 例如 2011-12-17 17:41:18.843 CST. - * @return 解析后的日期类型.若解析出错则返回null - */ - public static Date parseDate(String dateStr) { - try { - return NORMAL_DATE_FORMAT.parse(dateStr); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期() - */ - - public static long parseLong(String date) { - return parseDate(date).getTime() / 1000; - } - - /** - * 日期格式转换为字符串格式 - * - * @param date - * @return 格式化后的日期字符串 - */ - public static String parseString(Date date) { - - return NORMAL_DATE_FORMAT_YY_MM_DD.format(date); - } - - public static long getLastDayStartTime(long daytime) { - Calendar todayStart = Calendar.getInstance(); - todayStart.setTimeInMillis(daytime * 1000); - todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return todayStart.getTimeInMillis() / 1000; - } - - public static long getLastDayEndTime(long daytime) { - Calendar todayEnd = Calendar.getInstance(); - todayEnd.setTimeInMillis(daytime * 1000); - todayEnd.add(Calendar.DAY_OF_YEAR, -1); - todayEnd.set(Calendar.HOUR_OF_DAY, 23); - todayEnd.set(Calendar.MINUTE, 59); - todayEnd.set(Calendar.SECOND, 59); - todayEnd.set(Calendar.MILLISECOND, 999); - return todayEnd.getTimeInMillis() / 1000; - } - - public static long getTime(long time) { - Calendar timeCalendar = Calendar.getInstance(); - Calendar nowCalendar = Calendar.getInstance(); - timeCalendar.setTimeInMillis(time * 1000); - timeCalendar.set(Calendar.HOUR_OF_DAY, nowCalendar.get(Calendar.HOUR_OF_DAY)); - timeCalendar.set(Calendar.MINUTE, nowCalendar.get(Calendar.MINUTE)); - timeCalendar.set(Calendar.SECOND, nowCalendar.get(Calendar.SECOND)); - timeCalendar.set(Calendar.MILLISECOND, nowCalendar.get(Calendar.MILLISECOND)); - return timeCalendar.getTimeInMillis() / 1000; - } - - public static long getStartTime(long daytime) { - Calendar todayStart = Calendar.getInstance(); - todayStart.setTimeInMillis(daytime * 1000); - // todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return todayStart.getTime().getTime() / 1000; - } - - public static long getEndTime(long daytime) { - Calendar todayEnd = Calendar.getInstance(); - todayEnd.setTimeInMillis(daytime * 1000); - // todayEnd.add(Calendar.DAY_OF_YEAR, -1); - todayEnd.set(Calendar.HOUR_OF_DAY, 23); - todayEnd.set(Calendar.MINUTE, 59); - todayEnd.set(Calendar.SECOND, 59); - todayEnd.set(Calendar.MILLISECOND, 999); - return todayEnd.getTimeInMillis() / 1000; - } - - /** - * 比较俩日期是否是同一天 - * - * @param d1 - * @param d2 - * @return - */ - public static boolean compareSameDate(Date d1, Date d2) { - Calendar c1 = Calendar.getInstance(); - c1.setTime(d1); - Calendar c2 = Calendar.getInstance(); - c2.setTime(d2); - boolean isSameYear = c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR); - boolean isSameMonth = isSameYear && c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH); - boolean isSameDate = isSameMonth && c1.get(Calendar.DAY_OF_MONTH) == c2.get(Calendar.DAY_OF_MONTH); - return isSameDate; - } - - /** - * 当月的第一天距1970年1月1日秒数. - * - * @param date - * @return long - * @author mengxm - */ - public static final long firstMonthDayTime() { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.DAY_OF_MONTH, 1); - return cal.getTime().getTime() / 1000; - } - - /** - * 根据指定格式解析时间 - * - * @param dateString - * @param fmtString - * @return Date - * @author mengxm - */ - public static final Date parse(String dateString, String fmtString) { - Date date = null; - try { - DateFormat format = new SimpleDateFormat(fmtString); - date = format.parse(dateString); - } catch (ParseException e) { - e.printStackTrace(); - } - return date; - } - - /** 比较提现前后时间间隔秒数 */ - public static boolean getDatePoor(Date endDate, Date nowDate) { - - // 获得两个时间的毫秒时间差异 - System.out.println(endDate.getTime()); - System.out.println(nowDate.getTime()); - long diff = (endDate.getTime() - nowDate.getTime()) / 1000; - if (diff < 30) { - return true; - } - return false; - } - - /** - * 当前时间加几天 - * - * @param day - * 天数 - * @return - */ - public static long currentDateAddDay(int day) { - Calendar cal = Calendar.getInstance(); - try { - cal.setTime(NORMAL_DATE_FORMAT_YY_MM_DD.parse(getCurrentTime())); - cal.add(Calendar.DATE, day); // add N days - return cal.getTimeInMillis() / 1000; - } catch (ParseException e) { - e.printStackTrace(); - } - return 0l; - } - - public static long dateAddDay(long dateLong, int day) { - Calendar cal = Calendar.getInstance(); - Date d = new Date(dateLong * 1000); - cal.setTime(d); - cal.add(Calendar.DATE, day); - return cal.getTimeInMillis() / 1000; - } - - /** - * 计算两个日期之间相差的天数 - * - * @param smdate - * 较小的时间 - * @param bdate - * 较大的时间 - * @return 相差天数 - * @throws ParseException - */ - public static int daysBetween(Date smdate, Date bdate) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - long between_days = 0L; - try { - smdate = sdf.parse(sdf.format(smdate)); - bdate = sdf.parse(sdf.format(bdate)); - Calendar cal = Calendar.getInstance(); - cal.setTime(smdate); - long time1 = cal.getTimeInMillis(); - cal.setTime(bdate); - long time2 = cal.getTimeInMillis(); - between_days = (time2 - time1) / (1000 * 3600 * 24); - } catch (ParseException e) { - e.printStackTrace(); - } - return Integer.parseInt(String.valueOf(between_days)); - } - - /** 日期转换为自定义格式输出 */ - public static String DateToString(Date date, String formatType) { - if (date == null) { - return null; - } - if (formatType == null || "".equals(formatType)) { - return null; - } - String dateStr = ""; - try { - SimpleDateFormat sdf = new SimpleDateFormat(formatType); - dateStr = sdf.format(date); - return dateStr; - } catch (Exception e) { - return null; - } - } - - public static long getStartTimeCurrentDay() { - Calendar todayStart = Calendar.getInstance(); - // todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return todayStart.getTime().getTime() / 1000; - } - - public static long getEndTimeCurrentDay() { - Calendar todayStart = Calendar.getInstance(); - // todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 23); - todayStart.set(Calendar.MINUTE, 59); - todayStart.set(Calendar.SECOND, 59); - todayStart.set(Calendar.MILLISECOND, 59); - return todayStart.getTime().getTime() / 1000; - } - - /** 日期转换为自定义格式输出 */ - public static String fomatDate(Date date, String format) { - if (date == null) { - return ""; - } - if (format == null || "".equals(format)) { - return ""; - } - try { - SimpleDateFormat sdf = new SimpleDateFormat(format); - return sdf.format(date); - } catch (Exception e) { - e.printStackTrace(); - return ""; - - } - } - - public static String getLastDayFmtYYYYMMDD() { - Calendar todayStart = Calendar.getInstance(); - todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return NORMAL_DATE_FORMAT_YY_MM_DD_.format(todayStart.getTime()); - } - - /** - * @Title: getDateFormat - * @Description: 日期格式化 yyyy-MM-dd - * @param str - * @return String - */ - public static String getDateFormat(String str) { - return dateFormatYYMMDD(Long.parseLong(str)); - } - - /** - * @Title: getTimeFormat - * @Description: 时间格式化 yyyy-MM-dd HH:mm:ss - * @param str - * @return String - */ - public static String getTimeFormat(String str) { - return dateFormat(Long.parseLong(str)); - } - - public static void main(String[] args) { - - System.out.println(dateFormat(1441036802)); - System.out.println(getFirstDayOfMonth("2015", "9")); - System.out.println(getLastDayOfMonth("2015", "8")); - System.out.println(dateFormat(getLastMonthTime())); - System.out.println(dateFormat(getLastWeekTime())); - System.out.println(parseLong("2017-01-01 00:00:00")); - System.out.println(getTime()); - System.out.println(dateFormat(1451624155)); - System.out.println(parse("20151222", "yyyyMMdd")); - Calendar c = Calendar.getInstance(); - Date nowDate = c.getTime(); - c.set(Calendar.MINUTE, -1); - Date endDate = c.getTime(); - System.out.println("nowDate--" + nowDate + ";endDate--" + endDate); - System.out.println(getDatePoor(nowDate, endDate)); - System.out.println(dateFormatYYYYMMDD(new Date())); - - System.out.println("args = [" + DateUtil.currentDateAddDay(0) + "]"); - System.out.println("args = [" + DateUtil.parse("2016-01-19", "yyyy-MM-dd").getTime() + "]"); - - System.out.println(getTime()); - System.out.println(getEndTimeCurrentDay()); - - System.out.println(getEndTimeCurrentDay() - getTime()); - - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/DateUtils.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/DateUtils.java deleted file mode 100644 index 6f94a90..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/DateUtils.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -public class DateUtils { - public static final String DEFAULT_PATTERN = "yyyy-MM-dd"; - - public static String getOneDayFromNow(int day, String pattern) { - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - cal.add(Calendar.DAY_OF_MONTH, day); - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - return sdf.format(cal.getTime()); - } - - public static String getOneDayFromNow(int day) { - return DateUtils.getOneDayFromNow(day, DEFAULT_PATTERN); - } - - /** - * 计算两个日期之间相差的天数 - * - * @param smdate - * 较小的时间 - * @param bdate - * 较大的时间 - * @return 相差天数 - * @throws ParseException - * @throws java.text.ParseException - */ - public static int daysBetween(Date smdate, Date bdate) - throws ParseException { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - smdate = sdf.parse(sdf.format(smdate)); - bdate = sdf.parse(sdf.format(bdate)); - Calendar cal = Calendar.getInstance(); - cal.setTime(smdate); - long time1 = cal.getTimeInMillis(); - cal.setTime(bdate); - long time2 = cal.getTimeInMillis(); - long between_days = (time2 - time1) / (1000 * 3600 * 24); - - return Integer.parseInt(String.valueOf(between_days)); - } - - public static void main(String[] args) throws ParseException { - System.out.println(daysBetween(null, null)); - } - - /** - * 英文简写(默认)如:2010-12-01 - */ - public static String FORMAT_SHORT = "yyyy-MM-dd"; - /** - * 英文全称 如:2010-12-01 23:15:06 - */ - public static String FORMAT_LONG = "yyyy-MM-dd HH:mm:ss"; - /** - * 精确到毫秒的完整时间 如:yyyy-MM-dd HH:mm:ss.S - */ - public static String FORMAT_FULL = "yyyy-MM-dd HH:mm:ss.S"; - /** - * 中文简写 如:2010年12月01日 - */ - public static String FORMAT_SHORT_CN = "yyyy年MM月dd"; - /** - * 中文全称 如:2010年12月01日 23时15分06秒 - */ - public static String FORMAT_LONG_CN = "yyyy年MM月dd日 HH时mm分ss秒"; - /** - * 精确到毫秒的完整中文时间 - */ - public static String FORMAT_FULL_CN = "yyyy年MM月dd日 HH时mm分ss秒SSS毫秒"; - - /** - * 获得默认的 date pattern - */ - public static String getDatePattern() { - return FORMAT_LONG; - } - - /** - * 根据预设格式返回当前日期 - * - * @return - */ - public static String getNow() { - return format(new Date()); - } - - /** - * 根据用户格式返回当前日期 - * - * @param format - * @return - */ - public static String getNow(String format) { - return format(new Date(), format); - } - - /** - * 使用预设格式格式化日期 - * - * @param date - * @return - */ - public static String format(Date date) { - return format(date, getDatePattern()); - } - - /** - * 使用用户格式格式化日期 - * - * @param date - * 日期 - * @param pattern - * 日期格式 - * @return - */ - public static String format(Date date, String pattern) { - String returnValue = ""; - if (date != null) { - SimpleDateFormat df = new SimpleDateFormat(pattern); - returnValue = df.format(date); - } - return (returnValue); - } - - /** - * 使用用户格式格式化时间戳 - * - * @param timestamp - * 时间戳 - * @param pattern - * 日期格式 - * @return - */ - public static String format(String timestamp, String pattern) { - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - return sdf.format(new Date(Long.parseLong(timestamp))); - } - - /** - * 使用预设格式提取字符串日期 - * - * @param strDate - * 日期字符串 - * @return - */ - public static Date parse(String strDate) { - return parse(strDate, getDatePattern()); - } - - /** - * 使用用户格式提取字符串日期 - * - * @param strDate - * 日期字符串 - * @param pattern - * 日期格式 - * @return - */ - public static Date parse(String strDate, String pattern) { - SimpleDateFormat df = new SimpleDateFormat(pattern); - try { - return df.parse(strDate); - } catch (ParseException e) { - e.printStackTrace(); - return null; - } - } - - /** - * 在日期上增加数个整月 - * - * @param date - * 日期 - * @param n - * 要增加的月数 - * @return - */ - public static Date addMonth(Date date, int n) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(Calendar.MONTH, n); - return cal.getTime(); - } - - /** - * 在日期上增加天数 - * - * @param date - * 日期 - * @param n - * 要增加的天数 - * @return - */ - public static Date addDay(Date date, int n) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(Calendar.DATE, n); - return cal.getTime(); - } - - /** - * 获取时间戳 - */ - public static String getTimeString() { - SimpleDateFormat df = new SimpleDateFormat(FORMAT_FULL); - Calendar calendar = Calendar.getInstance(); - return df.format(calendar.getTime()); - } - - /** - * 获取日期年份 - * - * @param date - * 日期 - * @return - */ - public static String getYear(Date date) { - return format(date).substring(0, 4); - } - - /** - * 按默认格式的字符串距离今天的天数 - * - * @param date - * 日期字符串 - * @return - */ - public static int countDays(String date) { - long t = Calendar.getInstance().getTime().getTime(); - Calendar c = Calendar.getInstance(); - c.setTime(parse(date)); - long t1 = c.getTime().getTime(); - return (int) (t / 1000 - t1 / 1000) / 3600 / 24; - } - - /** - * 按用户格式字符串距离今天的天数 - * - * @param date - * 日期字符串 - * @param format - * 日期格式 - * @return - */ - public static int countDays(String date, String format) { - long t = Calendar.getInstance().getTime().getTime(); - Calendar c = Calendar.getInstance(); - c.setTime(parse(date, format)); - long t1 = c.getTime().getTime(); - return (int) (t / 1000 - t1 / 1000) / 3600 / 24; - } - - public static String timeFormat(Date date, String format, Boolean flag, int beforeDay, int nowDay) { - if(date == null) { - date = new Date(); - } - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - if(flag) { - cal.add(Calendar.DATE,-30); - } else { - cal.add(Calendar.DATE,0); - } - SimpleDateFormat sdf = new SimpleDateFormat(format); - return sdf.format(cal.getTime()); - } -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ExceptionSupport.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ExceptionSupport.java deleted file mode 100644 index b5763eb..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ExceptionSupport.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.tamguo.modules.sys.utils; - -/** - * 统一异常处理 日志处理 - * - */ -public class ExceptionSupport { - - private final static Result failResult = Result.failResult("500"); - private static LogHandler handler = new Log4jHandler(); - - private final static String LOG_INFO_PREFIX = "--info>> "; - private final static String LOG_ERROR_PREFIX = "--error>> "; - - public static Result resolverResult(String methodInfo, Class clazz, Exception e) { - if(e instanceof CException) { - handler.info(formatInfoLevelMsg(methodInfo, e.getMessage()), clazz.getName()); - return Result.failResult(e.getMessage()); - } - handler.error(formatErrorLevelMsg(methodInfo), e, clazz.getName()); - return failResult; - } - - private static String formatInfoLevelMsg(String methodInfo, String infoMsg) { - return LOG_INFO_PREFIX + methodInfo + ": " + infoMsg; - } - - private static String formatErrorLevelMsg(String methodInfo) { - return LOG_ERROR_PREFIX + methodInfo; - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/IdGen.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/IdGen.java deleted file mode 100644 index be66574..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/IdGen.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class IdGen -{ - private long workerId; - private long datacenterId; - private long sequence = 0L; - private long twepoch = 1288834974657L; - private long workerIdBits = 5L; - private long datacenterIdBits = 5L; - private long maxWorkerId = -1L ^ (-1L << workerIdBits); - private long maxDatacenterId = -1L ^ (-1L << datacenterIdBits); - private long sequenceBits = 12L; - private long workerIdShift = sequenceBits; - private long datacenterIdShift = sequenceBits + workerIdBits; - private long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; - private long sequenceMask = -1L ^ (-1L << sequenceBits); - private long lastTimestamp = -1L; - private String suffix; - private boolean flag; - - private static class IdGenHolder { - private static final IdGen instance = new IdGen(); - } - - public static IdGen get(){ - return IdGenHolder.instance; - } - - /** - * 获取字符串拼接id - * @param suffix 字符串 - * @param flag true:前缀 false:后缀 - * @return - */ - public static IdGen get(String suffix,boolean flag){ - if(suffix == null || suffix.trim().length() == 0) - return IdGenHolder.instance; - else{ - return new IdGen(suffix,flag); - } - } - - - public IdGen() { - this(0L, 0L); - } - - public IdGen(String suffix,boolean flag){ - this.suffix = suffix; - this.flag = flag; - } - - public IdGen(long workerId, long datacenterId) { - if (workerId > maxWorkerId || workerId < 0) { - throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId)); - } - if (datacenterId > maxDatacenterId || datacenterId < 0) { - throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId)); - } - this.workerId = workerId; - this.datacenterId = datacenterId; - } - - public synchronized String nextId() { - long timestamp = timeGen(); - 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; - } - lastTimestamp = timestamp; - - long serialNumber = ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift) - | (workerId << workerIdShift) | sequence; - - return (suffix == null || suffix.trim().length() == 0) ? serialNumber+"" : (flag ? (new StringBuffer()).append(suffix).append(serialNumber).toString() : (new StringBuffer()).append(serialNumber).append(suffix).toString()); - } - - protected long tilNextMillis(long lastTimestamp) { - long timestamp = timeGen(); - while (timestamp <= lastTimestamp) { - timestamp = timeGen(); - } - return timestamp; - } - - protected long timeGen() { - return System.currentTimeMillis(); - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Log4jHandler.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Log4jHandler.java deleted file mode 100644 index 9b5f6c5..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Log4jHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.event.Level; - -public class Log4jHandler extends AbstractRunningLogHandler { - - private static final Logger logger = LoggerFactory.getLogger(Log4jHandler.class); - - @Override - public void info(String msg, String fqnOfCallingClass) { - logger.info(fqnOfCallingClass, Level.INFO, msg, null); - } - - @Override - public void info(String msg, Throwable t, String fqnOfCallingClass) { - logger.info(fqnOfCallingClass, Level.INFO, msg, t); - } - - @Override - public void error(String msg, String fqnOfCallingClass) { - logger.error(fqnOfCallingClass, Level.ERROR, msg, null); - } - - @Override - public void error(String msg, Throwable t, String fqnOfCallingClass) { - logger.error(fqnOfCallingClass, Level.ERROR, msg, t); - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/LogDebug.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/LogDebug.java deleted file mode 100644 index 05917b1..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/LogDebug.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class LogDebug { - - private final static String DEBUG_LOG_KEY = "-- LogHandler: "; - - public static void debug(String msg) { - System.err.println(DEBUG_LOG_KEY + msg); - } - - public static void debug(String msg, Throwable t) { - System.err.println(DEBUG_LOG_KEY + msg); - if (t != null) - t.printStackTrace(System.err); - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/LogHandler.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/LogHandler.java deleted file mode 100644 index a6c8dc8..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/LogHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public interface LogHandler { - - public void info(String msg, String fqnOfCallingClass); - - public void info(String msg, Throwable t, String fqnOfCallingClass); - - public void error(String msg, String fqnOfCallingClass); - - public void error(String msg, Throwable t, String fqnOfCallingClass); - - public void debug(String msg, String fqnOfCallingClass); - - public void debug(String msg, Throwable t, String fqnOfCallingClass); - - public void warning(String msg, String fqnOfCallingClass); - - public void warning(String msg, Throwable t, String fqnOfCallingClass); - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ObjectUtil.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ObjectUtil.java deleted file mode 100644 index e9d0d3b..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ObjectUtil.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -public class ObjectUtil extends SerializeTranscoder { - @Override - public byte[] serialize(Object value) { - if (value == null) { - throw new NullPointerException("Can't serialize null"); - } - byte[] result = null; - ByteArrayOutputStream bos = null; - ObjectOutputStream os = null; - try { - bos = new ByteArrayOutputStream(); - os = new ObjectOutputStream(bos); - os.writeObject(value); - os.close(); - bos.close(); - result = bos.toByteArray(); - } catch (IOException e) { - throw new IllegalArgumentException("Non-serializable object", e); - } finally { - close(os); - close(bos); - } - return result; - } - - @Override - public Object deserialize(byte[] in) { - Object result = null; - ByteArrayInputStream bis = null; - ObjectInputStream is = null; - try { - if (in != null) { - bis = new ByteArrayInputStream(in); - is = new ObjectInputStream(bis); - result = is.readObject(); - is.close(); - bis.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } finally { - close(is); - close(bis); - } - return result; - } - - public static boolean equals(Object o1, Object o2) { - - if (o1 == o2) { - return true; - } else if (o1 == null || o2 == null) { - return false; - } else { - return o1.equals(o2); - } - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/RequestHelper.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/RequestHelper.java deleted file mode 100644 index 739342b..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/RequestHelper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class RequestHelper { - private static Logger logger = LoggerFactory.getLogger(RequestHelper.class); - - /** - * 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址; - * - * @param request - * @return - * @throws IOException - */ - public final static String getIpAddress(HttpServletRequest request) { - // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址 - String ip = request.getHeader("X-Forwarded-For"); - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_CLIENT_IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_X_FORWARDED_FOR"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - } else if (ip.length() > 15) { - String[] ips = ip.split(","); - for (int index = 0; index < ips.length; index++) { - String strIp = (String) ips[index]; - if (!("unknown".equalsIgnoreCase(strIp))) { - ip = strIp; - break; - } - } - } - if (logger.isInfoEnabled()) { - logger.info("getIpAddress(HttpServletRequest) - Proxy-Client-IP - String ip=" + ip); - } - return ip; - } -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Result.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Result.java deleted file mode 100644 index 5492e63..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Result.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class Result implements Serializable { - - private static final long serialVersionUID = -1651614836984397356L; - - private int code; - - private Object result; - - private String message; - - public static final int SUCCESS_CODE = 0; - - public static final int FAIL_CODE = 1; - - private Result() { - } - - private Result(int code, Object result, String message) { - this.code = code; - this.result = result; - this.message = message; - } - - /** - * 成功响应 - * - * @param result - * @return - */ - public static Result successResult(Object result) { - return result(SUCCESS_CODE, result, ""); - } - - public static Result successResult(Object records, Long recordSum, Long rowsOfPage) { - return successResult(records, recordSum, rowsOfPage, null); - } - - public static Result successResult(Object records, Long recordSum, Long rowsOfPage, Object userData) { - Map result = resultOfList(records, recordSum, rowsOfPage, userData); - - return successResult(result); - } - - public static Map resultOfList(Object records, Long recordSum, Long rowsOfPage) { - return resultOfList(records, recordSum, rowsOfPage, null); - } - - public static Map resultOfList(Object Obj, Long records, Long rowsOfPage, Object userData) { - Map result = new HashMap(); - result.put("rows", Obj); - result.put("records", records); - result.put("total", rowsOfPage); - if (null != userData) { - result.put("userdata", userData); - } - ; - return result; - } - - public static Map jqGridResult(List list, long totalCount, int pageSize, int currPage, - int totalPage) { - Map result = new HashMap(); - result.put("list", list); - result.put("count", totalCount); - result.put("next", currPage == totalPage ? currPage : currPage + 1); - result.put("prev", currPage == 1 ? 1 : currPage - 1); - result.put("first", 1); - result.put("last", totalPage); - result.put("pageSize", pageSize); - result.put("pageNo", currPage); - return result; - } - - /** - * 失败响应 - * - * @param errorMsg - * @return - */ - public static Result failResult(String errorMsg) { - return result(FAIL_CODE, "", errorMsg); - } - - public static Result result(int code, Object result, String message) { - Result res = new Result(code, result, message); - return res; - } - - public int getCode() { - return code; - } - - public Object getResult() { - return result; - } - - public String getMessage() { - return message; - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/SerializeTranscoder.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/SerializeTranscoder.java deleted file mode 100644 index 4a11f39..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/SerializeTranscoder.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.Closeable; - -public abstract class SerializeTranscoder { - - public abstract byte[] serialize(Object value); - - public abstract Object deserialize(byte[] in); - - public void close(Closeable closeable) { - if (closeable != null) { - try { - closeable.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Setting.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Setting.java deleted file mode 100644 index e1eb604..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Setting.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -/** - * Setting - 系统 - * - * @author candy.tam - * - */ -@Component -public final class Setting { - - /** 域名 */ - @Value(value="${domain.name}") - public String domain; - /** 静态资源地址*/ - @Value(value="${static.domain}") - public String staticDomain; - @Value(value="${version}") - public String version; - /** 真题 */ - public final String PAPER_TYPE_ZHENTI = "1"; - /** 模拟*/ - public final String PAPER_TYPE_MONI = "2"; - /** 押题*/ - public final String PAPER_TYPE_YATI = "3"; - /** 名校 */ - public final String PAPER_TYPE_MINGXIAO = "4"; - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ShaEncrypt.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ShaEncrypt.java deleted file mode 100644 index 517a270..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ShaEncrypt.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -public class ShaEncrypt { - - /** - * 传入文本内容,返回 SHA-256 串 - * - * @param strText - * @return - */ - public static String SHA256(final String strText) { - return SHA(strText, "SHA-256"); - } - - /** - * 传入文本内容,返回 SHA-512 串 - * - * @param strText - * @return - */ - public static String SHA512(final String strText) { - return SHA(strText, "SHA-512"); - } - - /** - * 字符串 SHA 加密 - * - * @param strSourceText - * @return - */ - private static String SHA(final String strText, final String strType) { - // 返回值 - String strResult = null; - - // 是否是有效字符串 - if (strText != null && strText.length() > 0) { - try { - // SHA 加密开始 - // 创建加密对象 并傳入加密類型 - MessageDigest messageDigest = MessageDigest.getInstance(strType); - // 传入要加密的字符串 - messageDigest.update(strText.getBytes()); - // 得到 byte 類型结果 - byte byteBuffer[] = messageDigest.digest(); - - // 將 byte 轉換爲 string - StringBuffer strHexString = new StringBuffer(); - // 遍歷 byte buffer - for (int i = 0; i < byteBuffer.length; i++) { - String hex = Integer.toHexString(0xff & byteBuffer[i]); - if (hex.length() == 1) { - strHexString.append('0'); - } - strHexString.append(hex); - } - // 得到返回結果 - strResult = strHexString.toString(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - } - - return strResult; - } -} \ No newline at end of file diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ShiroUtils.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ShiroUtils.java deleted file mode 100644 index d2604ef..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/ShiroUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.session.Session; -import org.apache.shiro.subject.Subject; - -import com.tamguo.modules.sys.model.SysUserEntity; - -public class ShiroUtils { - - public static Session getSession() { - return SecurityUtils.getSubject().getSession(); - } - - public static Subject getSubject() { - return SecurityUtils.getSubject(); - } - - public static SysUserEntity getUser() { - return (SysUserEntity)SecurityUtils.getSubject().getPrincipal(); - } - - public static String getUserCode() { - return getUser().getUserCode(); - } - - public static void setSessionAttribute(Object key, Object value) { - getSession().setAttribute(key, value); - } - - public static Object getSessionAttribute(Object key) { - return getSession().getAttribute(key); - } - - public static boolean isLogin() { - return SecurityUtils.getSubject().getPrincipal() != null; - } - - public static void logout() { - SecurityUtils.getSubject().logout(); - } - - public static String getKaptcha(String key) { - String kaptcha = getSessionAttribute(key).toString(); -// getSession().removeAttribute(key); - return kaptcha; - } - -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Status.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Status.java deleted file mode 100644 index c731d24..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Status.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public enum Status { - SUCCESS , ERROR -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/TamguoConstant.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/TamguoConstant.java deleted file mode 100644 index df91baa..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/TamguoConstant.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class TamguoConstant { - - public static final String WEBSITE_NAME = "探果网"; - - public static final String REDIS_PRE_KEY = "TAMGUO:"; - - /** 高考SubjectId*/ - public static final String GAOKAO_SUBJECT_ID = "13"; - - /** 高考专区缓存KEY*/ - public static final String GAOKAO_COURSE_AREA = "GAOKAO_COURSE_AREA"; - - /** 首页菜单缓存KEY*/ - public static final String INDEX_MENU = "index_menu"; - - /** 首页菜单缓存KEY*/ - public static final String ALL_INDEX_MENU = "all_index_menu"; - - /** 首页左侧菜单缓存KEY*/ - public static final String LEFT_INDEX_MENU = "left_index_menu"; - - /** 首页底部菜单缓存KEY*/ - public static final String FOOTER_INDEX_MENU = "footer_index_menu"; - - /** 北京地区ID*/ - public static final String BEIJING_AREA_ID = "1"; - - /** 真题类型ID*/ - public static final String ZHENGTI_PAPER_ID = "1"; - - /** 模拟类型ID */ - public static final String SIMULATION_PAPER_ID = "2"; - - /** 首页历年真题缓存KEY*/ - public static final String HISTORY_PAPER = "HistoryPaper:"; - - /** 首页模拟试卷缓存KEY*/ - public static final String SIMULATION_PAPER = "SimulationPaper:"; - - /** 首页热门试卷缓存KEY*/ - public static final String HOT_PAPER = "HOT_PAPER"; - - /** 名校试卷缓存KEY*/ - public static final String ELITE_SCHOOL_PAPER = "EliteSchoolPaper:"; - - /** 所有广告缓存KEY*/ - public static final String ALL_AD = "AllAd:"; - - /** 名校缓存KEY*/ - public static final String ELITE_PAPER = "ElitePaper:"; - - /** 章节科目为空*/ - public static final String CHAPTER_COURSE_EMPTY = "all"; - - /** 默认分页大笑*/ - public static final Integer DEFAULT_PAGE_SIZE = 10; - - /** 单选题*/ - public static final String QUESTION_TYOE_DANXUANTI = "1"; - - /** 简答题*/ - public static final String QUESTION_TYOE_JIANDATI = "2"; - - /** 书面表达*/ - public static final String QUESTION_TYOE_SHUMIANBIAODA = "3"; - - /** 默认会员头像*/ - public static final String DEFAULT_MEMBER_AVATAR = "images/avatar.png"; - - /** 重置密码KEY*/ - public static final String RESET_PASSWORD_KEY = "ResetPasswordKey"; - - /** ALIYUN */ - public static final String ALIYUN_ACCESS_KEY_ID = "LTAINGkheMeWtxUR"; - - /** ALIYUN*/ - public static final String ALIYUN_ACCESS_KEY_SECRET = "ONUKuCz85kU4In07y4dvpM28mfWOGa"; - - /** ALIYUN*/ - public static final String ALIYUN_SMTP_HOST_NAME = "smtp.aliyun.com"; - - /** ALIYUN*/ - public static final int ALIYUN_SMTP_HOST_PORT = 465; - - /** ALIYUN*/ - public static final String ALIYUN_MAIL_ACCOUNT = "candy.tam@aliyun.com"; - - /** ALIYUN*/ - public static final String ALIYUN_MAIL_PASSWORD = "tanguo520pig"; - - /** 邮件主题*/ - public static final String ALIYUN_MAIL_SUBJECT_FINDPASSWORD = "探果网找回密码"; - - /** 邮箱找回密码前缀*/ - public static final String ALIYUN_MAIL_FIND_PASSWORD_PREFIX = "EMAIL_FIND_PASSWORD_"; - - /** 短信找回密码前缀*/ - public static final String ALIYUN_MOBILE_SMS_PREFIX = "MOBILE_SMS_PREKEY_"; - - /** 安全验证前缀*/ - public static final String SECURITY_CHECK_PREFIX = "securityCheck:"; - - /** 默认的章节根目录*/ - public static final String CHAPTER_DEFAULT_ROOT_UID = "-1"; - - /** 登录错误次数*/ - public static final String LOGIN_FAILURE_COUNT = "loginFailureCount:"; - - /** 题目未审核*/ - public static final String QUESTION_NOTHING_AUDIT_STATUS = "0"; - - /** 题目审核成功*/ - public static final String QUESTION_SUCCESS_AUDIT_STATUS = "1"; - - /** 题目审核失败*/ - public static final String QUESTION_FAILED_AUDIT_STATUS = "2"; - - /** 题目审核失败*/ - public static final String TEACHER_ROLE_ID = "2"; - - /** 初始密码*/ - public static final String INIT_PASSWORD = "123456"; - - /** 验证码常数*/ - public static final String KAPTCHA_SESSION_KEY = "KAPTCHA_SESSION_KEY"; -} diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Uploader.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Uploader.java deleted file mode 100644 index 3c559d3..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/Uploader.java +++ /dev/null @@ -1,260 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.*; -import java.text.SimpleDateFormat; -import java.util.*; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.fileupload.*; -import org.apache.commons.fileupload.FileUploadBase.InvalidContentTypeException; -import org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException; -import org.apache.commons.fileupload.util.*; -import org.apache.commons.fileupload.servlet.*; -import org.apache.commons.fileupload.FileItemIterator; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import javax.servlet.http.HttpServletRequest; -/** - * UEditor文件上传辅助类 - * - */ -public class Uploader { - // 输出文件地址 - private String url = ""; - // 上传文件名 - private String fileName = ""; - // 状态 - private String state = ""; - // 文件类型 - private String type = ""; - // 原始文件名 - private String originalName = ""; - // 文件大小 - private long size = 0; - - private HttpServletRequest request = null; - private String title = ""; - - // 保存路径 - private String savePath = "upload"; - // 文件允许格式 - private String[] allowFiles = { ".rar", ".doc", ".docx", ".zip", ".pdf",".txt", ".swf", ".wmv", ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; - // 文件大小限制,单位KB - private int maxSize = 10000; - - private HashMap errorInfo = new HashMap(); - - public Uploader(HttpServletRequest request) { - this.request = request; - HashMap tmp = this.errorInfo; - tmp.put("SUCCESS", "SUCCESS"); //默认成功 - tmp.put("NOFILE", "未包含文件上传域"); - tmp.put("TYPE", "不允许的文件格式"); - tmp.put("SIZE", "文件大小超出限制"); - tmp.put("ENTYPE", "请求类型ENTYPE错误"); - tmp.put("REQUEST", "上传请求异常"); - tmp.put("IO", "IO异常"); - tmp.put("DIR", "目录创建失败"); - tmp.put("UNKNOWN", "未知错误"); - - } - - public void upload() throws Exception { - boolean isMultipart = ServletFileUpload.isMultipartContent(this.request); - if (!isMultipart) { - this.state = this.errorInfo.get("NOFILE"); - return; - } - DiskFileItemFactory dff = new DiskFileItemFactory(); - String savePath = this.getFolder(this.savePath); - dff.setRepository(new File(savePath)); - try { - ServletFileUpload sfu = new ServletFileUpload(dff); - sfu.setSizeMax(this.maxSize * 1024); - sfu.setHeaderEncoding("utf-8"); - FileItemIterator fii = sfu.getItemIterator(this.request); - while (fii.hasNext()) { - FileItemStream fis = fii.next(); - if (!fis.isFormField()) { - this.originalName = fis.getName().substring(fis.getName().lastIndexOf(System.getProperty("file.separator")) + 1); - if (!this.checkFileType(this.originalName)) { - this.state = this.errorInfo.get("TYPE"); - continue; - } - this.fileName = this.getName(this.originalName); - this.type = this.getFileExt(this.fileName); - this.url = savePath + "/" + this.fileName; - BufferedInputStream in = new BufferedInputStream(fis.openStream()); - File file = new File(this.getPhysicalPath(this.url)); - FileOutputStream out = new FileOutputStream( file ); - BufferedOutputStream output = new BufferedOutputStream(out); - Streams.copy(in, output, true); - this.state=this.errorInfo.get("SUCCESS"); - this.size = file.length(); - //UE中只会处理单张上传,完成后即退出 - break; - } else { - String fname = fis.getFieldName(); - //只处理title,其余表单请自行处理 - if(!fname.equals("pictitle")){ - continue; - } - BufferedInputStream in = new BufferedInputStream(fis.openStream()); - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - StringBuffer result = new StringBuffer(); - while (reader.ready()) { - result.append((char)reader.read()); - } - this.title = new String(result.toString().getBytes(),"utf-8"); - reader.close(); - - } - } - } catch (SizeLimitExceededException e) { - this.state = this.errorInfo.get("SIZE"); - } catch (InvalidContentTypeException e) { - this.state = this.errorInfo.get("ENTYPE"); - } catch (FileUploadException e) { - this.state = this.errorInfo.get("REQUEST"); - } catch (Exception e) { - this.state = this.errorInfo.get("UNKNOWN"); - } - } - - /** - * 接受并保存以base64格式上传的文件 - * @param fieldName - */ - public void uploadBase64(String fieldName){ - String savePath = this.getFolder(this.savePath); - String base64Data = this.request.getParameter(fieldName); - this.fileName = this.getName("test.png"); - this.url = savePath + "/" + this.fileName; - try { - File outFile = new File(this.getPhysicalPath(this.url)); - OutputStream ro = new FileOutputStream(outFile); - byte[] b = Base64.decodeBase64(base64Data); - for (int i = 0; i < b.length; ++i) { - if (b[i] < 0) { - b[i] += 256; - } - } - ro.write(b); - ro.flush(); - ro.close(); - this.state=this.errorInfo.get("SUCCESS"); - } catch (Exception e) { - this.state = this.errorInfo.get("IO"); - } - } - - /** - * 文件类型判断 - * - * @param fileName - * @return - */ - private boolean checkFileType(String fileName) { - Iterator type = Arrays.asList(this.allowFiles).iterator(); - while (type.hasNext()) { - String ext = type.next(); - if (fileName.toLowerCase().endsWith(ext)) { - return true; - } - } - return false; - } - - /** - * 获取文件扩展名 - * - * @return string - */ - private String getFileExt(String fileName) { - return fileName.substring(fileName.lastIndexOf(".")); - } - - /** - * 依据原始文件名生成新文件名 - * @return - */ - private String getName(String fileName) { - Random random = new Random(); - return this.fileName = "" + random.nextInt(10000) - + System.currentTimeMillis() + this.getFileExt(fileName); - } - - /** - * 根据字符串创建本地目录 并按照日期建立子目录返回 - * @param path - * @return - */ - private String getFolder(String path) { - SimpleDateFormat formater = new SimpleDateFormat("yyyyMMdd"); - path += "/" + formater.format(new Date()); - File dir = new File(this.getPhysicalPath(path)); - if (!dir.exists()) { - try { - dir.mkdirs(); - } catch (Exception e) { - this.state = this.errorInfo.get("DIR"); - return ""; - } - } - return path; - } - - /** - * 根据传入的虚拟路径获取物理路径 - * - * @param path - * @return - */ - private String getPhysicalPath(String path) { - String servletPath = this.request.getServletPath(); - String realPath = this.request.getSession().getServletContext() - .getRealPath(servletPath); - return new File(realPath).getParent() +"/" +path; - } - - public void setSavePath(String savePath) { - this.savePath = savePath; - } - - public void setAllowFiles(String[] allowFiles) { - this.allowFiles = allowFiles; - } - - public void setMaxSize(int size) { - this.maxSize = size; - } - - public long getSize() { - return this.size; - } - - public String getUrl() { - return this.url; - } - - public String getFileName() { - return this.fileName; - } - - public String getState() { - return this.state; - } - - public String getTitle() { - return this.title; - } - - public String getType() { - return this.type; - } - - public String getOriginalName() { - return this.originalName; - } -} - diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/UploaderMessage.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/UploaderMessage.java deleted file mode 100644 index 3eeb74d..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/UploaderMessage.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.util.ArrayList; - - -public class UploaderMessage { - private Status status; - private String statusMsg = ""; - private ArrayList errorKys; - private String error = ""; - private String filePath = ""; - - public Status getStatus() { - return status; - } - - public void setStatus(Status status) { - this.status = status; - } - - public String getStatusMsg() { - return statusMsg; - } - - public void setStatusMsg(String statusMsg) { - this.statusMsg = statusMsg; - } - - public ArrayList getErrorKys() { - return errorKys; - } - - public void setErrorKys(ArrayList errorKys) { - this.errorKys = errorKys; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - -} - - - - diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/XMLConfiguration.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/XMLConfiguration.java deleted file mode 100644 index b7aab39..0000000 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/sys/utils/XMLConfiguration.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.IOException; -import java.io.InputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; - -public class XMLConfiguration { - private Document document = null; - - public boolean readConfigFile(String configFilename) { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder db = dbf.newDocumentBuilder(); - document = db.parse(configFilename); - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - if (document == null) { - return false; - } - return true; - } - - public boolean readConfigFile(InputStream stream) { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder db = dbf.newDocumentBuilder(); - document = db.parse(stream); - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - if (document == null) { - return false; - } - return true; - } - - public Document getDocument() { - return document; - } - - protected void setDocument(Document document) { - this.document = document; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java b/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java index d5ef840..d0c8b11 100644 --- a/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java +++ b/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java @@ -3,6 +3,8 @@ package com.tamguo.config.dao; import com.baomidou.mybatisplus.mapper.MetaObjectHandler; import com.tamguo.modules.sys.utils.ShiroUtils; +import java.util.Date; + import org.apache.ibatis.reflection.MetaObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,14 +19,15 @@ public class MyMetaObjectHandler extends MetaObjectHandler { @Override public void insertFill(MetaObject metaObject) { - Object testType = getFieldValByName("createBy", metaObject); - if (testType == null) { - setFieldValByName("createBy", ShiroUtils.getUser() , metaObject); //mybatis-plus版本2.0.9+ - } + setFieldValByName("createBy", ShiroUtils.getUserCode() , metaObject); + setFieldValByName("updateBy", ShiroUtils.getUserCode() , metaObject); + setFieldValByName("createDate", new Date() , metaObject); + setFieldValByName("updateDate", new Date() , metaObject); } @Override public void updateFill(MetaObject metaObject) { - logger.info("更新的时候干点不可描述的事情"); + setFieldValByName("updateBy", ShiroUtils.getUserCode() , metaObject); + setFieldValByName("updateDate", new Date() , metaObject); } } diff --git a/tamguo-oms/src/main/java/com/tamguo/config/dao/SuperEntity.java b/tamguo-oms/src/main/java/com/tamguo/config/dao/SuperEntity.java deleted file mode 100644 index 6ed3e17..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/config/dao/SuperEntity.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.tamguo.config.dao; - -import java.io.Serializable; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableId; - -/** - * 实体父类 - */ -public class SuperEntity> extends Model { - - private static final long serialVersionUID = 1L; - - @TableId("id") - private String id; - - @Override - protected Serializable pkVal() { - return this.getId(); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/config/dao/SuperMapper.java b/tamguo-oms/src/main/java/com/tamguo/config/dao/SuperMapper.java deleted file mode 100644 index 6b8b4cf..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/config/dao/SuperMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.tamguo.config.dao; - -import com.baomidou.mybatisplus.mapper.BaseMapper; - -/** - * 演示 mapper 父类,注意这个类不要让 mp 扫描到!! - */ -public interface SuperMapper extends BaseMapper { - - // 这里可以放一些公共的方法 -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysAreaMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysAreaMapper.java deleted file mode 100644 index 206adfe..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysAreaMapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import java.util.List; -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysAreaEntity; -import com.tamguo.modules.sys.model.condition.SysAreaCondition; - -public interface SysAreaMapper extends SuperMapper{ - - List listData(SysAreaCondition condition); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysCompanyMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysCompanyMapper.java deleted file mode 100644 index 99ce9bb..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysCompanyMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import java.util.List; - -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysCompanyEntity; -import com.tamguo.modules.sys.model.condition.SysCompanyCondition; - -public interface SysCompanyMapper extends SuperMapper{ - - List listData(SysCompanyCondition condition); - - SysCompanyEntity selectByCode(String code); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysMenuMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysMenuMapper.java deleted file mode 100644 index 1d16364..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysMenuMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import java.util.List; -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysMenuEntity; -import com.tamguo.modules.sys.model.condition.SysMenuCondition; - -public interface SysMenuMapper extends SuperMapper{ - - List listData(SysMenuCondition condition); - - List selectMenuByRoleId(String roleCode); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysOfficeMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysOfficeMapper.java deleted file mode 100644 index 5b9727e..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysOfficeMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import java.util.List; - -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysOfficeEntity; -import com.tamguo.modules.sys.model.condition.SysOfficeCondition; - -public interface SysOfficeMapper extends SuperMapper{ - - List listData(SysOfficeCondition condition); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysPostMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysPostMapper.java deleted file mode 100644 index 9e621b0..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysPostMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import java.util.List; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysPostEntity; -import com.tamguo.modules.sys.model.condition.SysPostCondition; - -public interface SysPostMapper extends SuperMapper{ - - List listData(SysPostCondition condition , Pagination page); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleDataScopeMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleDataScopeMapper.java deleted file mode 100644 index bbf8b5e..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleDataScopeMapper.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysRoleDataScopeEntity; - -public interface SysRoleDataScopeMapper extends SuperMapper{ - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleMapper.java deleted file mode 100644 index 23c0f43..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import java.util.List; -import com.baomidou.mybatisplus.plugins.Page; -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysRoleEntity; -import com.tamguo.modules.sys.model.condition.SysRoleCondition; - -public interface SysRoleMapper extends SuperMapper{ - - List listData(SysRoleCondition condition, Page page); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleMenuMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleMenuMapper.java deleted file mode 100644 index df2e239..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysRoleMenuMapper.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysRoleMenuEntity; - -public interface SysRoleMenuMapper extends SuperMapper{ - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserDataScopeMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserDataScopeMapper.java deleted file mode 100644 index c810093..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserDataScopeMapper.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysUserDataScopeEntity; - -public interface SysUserDataScopeMapper extends SuperMapper{ - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserMapper.java deleted file mode 100644 index e555d75..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import java.util.List; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysUserEntity; -import com.tamguo.modules.sys.model.condition.SysUserCondition; - -public interface SysUserMapper extends SuperMapper{ - - List listData(SysUserCondition condition, Pagination page); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserPostMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserPostMapper.java deleted file mode 100644 index 9905bbb..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserPostMapper.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import com.tamguo.config.dao.SuperMapper; -import com.tamguo.modules.sys.model.SysUserPostEntity; - -public interface SysUserPostMapper extends SuperMapper{ - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserRoleMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserRoleMapper.java deleted file mode 100644 index 5d9b567..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysUserRoleMapper.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.tamguo.modules.sys.dao; - -import com.baomidou.mybatisplus.mapper.BaseMapper; -import com.tamguo.modules.sys.model.SysUserRoleEntity; - -public interface SysUserRoleMapper extends BaseMapper{ - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysAreaEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysAreaEntity.java deleted file mode 100644 index d234c78..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysAreaEntity.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.tamguo.modules.sys.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -import com.alibaba.fastjson.annotation.JSONField; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.annotations.TableName; -import com.tamguo.modules.sys.model.enums.SysAreaStatusEnum; - - -/** - * The persistent class for the sys_area database table. - * - */ -@TableName(value="sys_area") -public class SysAreaEntity implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String ROOT_AREA_CODE = "0"; - public static final String TREE_CODE_AREA_SEPARATE = ","; - public static final String TREE_NAME_AREA_SEPARATE = "/"; - - @TableId - private String areaCode; - private String areaName; - private String areaType; - private String createBy; - private Date createDate; - private String parentCode; - private String parentCodes; - private String remarks; - - @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString) - private SysAreaStatusEnum status; - - private Boolean treeLeaf; - private BigDecimal treeLevel; - private String treeNames; - private BigDecimal treeSort; - private String treeSorts; - private String updateBy; - private Date updateDate; - - public SysAreaEntity() { - } - - public String getAreaCode() { - return this.areaCode; - } - - public void setAreaCode(String areaCode) { - this.areaCode = areaCode; - } - - public String getAreaName() { - return this.areaName; - } - - public void setAreaName(String areaName) { - this.areaName = areaName; - } - - public String getAreaType() { - return this.areaType; - } - - public void setAreaType(String areaType) { - this.areaType = areaType; - } - - public String getCreateBy() { - return this.createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateDate() { - return this.createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public String getParentCode() { - return this.parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - - public String getParentCodes() { - return this.parentCodes; - } - - public void setParentCodes(String parentCodes) { - this.parentCodes = parentCodes; - } - - public String getRemarks() { - return this.remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public BigDecimal getTreeLevel() { - return this.treeLevel; - } - - public void setTreeLevel(BigDecimal treeLevel) { - this.treeLevel = treeLevel; - } - - public String getTreeNames() { - return this.treeNames; - } - - public void setTreeNames(String treeNames) { - this.treeNames = treeNames; - } - - public BigDecimal getTreeSort() { - return this.treeSort; - } - - public void setTreeSort(BigDecimal treeSort) { - this.treeSort = treeSort; - } - - public String getTreeSorts() { - return this.treeSorts; - } - - public void setTreeSorts(String treeSorts) { - this.treeSorts = treeSorts; - } - - public String getUpdateBy() { - return this.updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateDate() { - return this.updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public String getId() { - return getAreaCode(); - } - - public Boolean getTreeLeaf() { - return treeLeaf; - } - - public void setTreeLeaf(Boolean treeLeaf) { - this.treeLeaf = treeLeaf; - } - - public SysAreaStatusEnum getStatus() { - return status; - } - - public void setStatus(SysAreaStatusEnum status) { - this.status = status; - } -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysCompanyEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysCompanyEntity.java deleted file mode 100644 index b66d743..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysCompanyEntity.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.tamguo.modules.sys.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -import com.baomidou.mybatisplus.annotations.KeySequence; -import com.baomidou.mybatisplus.annotations.TableField; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.annotations.TableName; - -/** - * The persistent class for the sys_company database table. - * - */ -@TableName(value="sys_company") -@KeySequence -public class SysCompanyEntity implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String ROOT_COMPANY_CODE = "0"; - public static final String TREE_CODE_COMPANY_SEPARATE = ","; - public static final String TREE_NAME_COMPANY_SEPARATE = "/"; - - @TableId - private String companyCode; - private String areaCode; - private String companyName; - private String corpCode; - private String corpName; - private String createBy; - private Date createDate; - private String fullName; - private String parentCode; - private String parentCodes; - private String remarks; - private String status; - private Boolean treeLeaf; - private BigDecimal treeLevel; - private String treeNames; - private String treeSort; - private String treeSorts; - private String updateBy; - private Date updateDate; - private String viewCode; - - @TableField(exist=false) - private String treeAreaNames; - - public SysCompanyEntity() { - } - - public String getAreaCode() { - return this.areaCode; - } - - public void setAreaCode(String areaCode) { - this.areaCode = areaCode; - } - - public String getCompanyName() { - return this.companyName; - } - - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - - public String getCorpCode() { - return this.corpCode; - } - - public void setCorpCode(String corpCode) { - this.corpCode = corpCode; - } - - public String getCorpName() { - return this.corpName; - } - - public void setCorpName(String corpName) { - this.corpName = corpName; - } - - public String getCreateBy() { - return this.createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateDate() { - return this.createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public String getFullName() { - return this.fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public String getParentCode() { - return this.parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - - public String getParentCodes() { - return this.parentCodes; - } - - public void setParentCodes(String parentCodes) { - this.parentCodes = parentCodes; - } - - public String getRemarks() { - return this.remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public String getStatus() { - return this.status; - } - - public void setStatus(String status) { - this.status = status; - } - - public BigDecimal getTreeLevel() { - return this.treeLevel; - } - - public void setTreeLevel(BigDecimal treeLevel) { - this.treeLevel = treeLevel; - } - - public String getTreeNames() { - return this.treeNames; - } - - public void setTreeNames(String treeNames) { - this.treeNames = treeNames; - } - - public String getTreeSort() { - return this.treeSort; - } - - public void setTreeSort(String treeSort) { - this.treeSort = treeSort; - } - - public String getTreeSorts() { - return this.treeSorts; - } - - public void setTreeSorts(String treeSorts) { - this.treeSorts = treeSorts; - } - - public String getUpdateBy() { - return this.updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateDate() { - return this.updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public String getViewCode() { - return this.viewCode; - } - - public void setViewCode(String viewCode) { - this.viewCode = viewCode; - } - - public Boolean getTreeLeaf() { - return treeLeaf; - } - - public void setTreeLeaf(Boolean treeLeaf) { - this.treeLeaf = treeLeaf; - } - - public String getId() { - return this.getCompanyCode(); - } - - public String getCompanyCode() { - return companyCode; - } - - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } - - public String getTreeAreaNames() { - return treeAreaNames; - } - - public void setTreeAreaNames(String treeAreaNames) { - this.treeAreaNames = treeAreaNames; - } - -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysMenuEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysMenuEntity.java deleted file mode 100644 index 70a8c36..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysMenuEntity.java +++ /dev/null @@ -1,255 +0,0 @@ -package com.tamguo.modules.sys.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -import com.alibaba.fastjson.annotation.JSONField; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.annotations.TableName; -import com.tamguo.modules.sys.model.enums.SysMenuStatusEnum; - - -/** - * The persistent class for the sys_menu database table. - * - */ -@TableName(value="sys_menu") -public class SysMenuEntity implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String ROOT_MENU_CODE = "0"; - public static final String TREE_CODE_MENU_SEPARATE = ","; - public static final String TREE_NAME_MENU_SEPARATE = "/"; - - @TableId - private String menuCode; - private String createBy; - private Date createDate; - private String isShow; - private String menuColor; - private String menuHref; - private String menuIcon; - private String menuName; - private String menuTarget; - private String menuType; - private String parentCode; - private String parentCodes; - private String permission; - private String remarks; - - @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString) - private SysMenuStatusEnum status; - private String sysCode; - private Boolean treeLeaf; - private BigDecimal treeLevel; - private String treeNames; - private BigDecimal treeSort; - private String treeSorts; - private String updateBy; - private Date updateDate; - private BigDecimal weight; - - public SysMenuEntity() { - } - - public String getMenuCode() { - return this.menuCode; - } - - public void setMenuCode(String menuCode) { - this.menuCode = menuCode; - } - - public String getCreateBy() { - return this.createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateDate() { - return this.createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public String getIsShow() { - return this.isShow; - } - - public void setIsShow(String isShow) { - this.isShow = isShow; - } - - public String getMenuColor() { - return this.menuColor; - } - - public void setMenuColor(String menuColor) { - this.menuColor = menuColor; - } - - public String getMenuHref() { - return this.menuHref; - } - - public void setMenuHref(String menuHref) { - this.menuHref = menuHref; - } - - public String getMenuIcon() { - return this.menuIcon; - } - - public void setMenuIcon(String menuIcon) { - this.menuIcon = menuIcon; - } - - public String getMenuName() { - return this.menuName; - } - - public void setMenuName(String menuName) { - this.menuName = menuName; - } - - public String getMenuTarget() { - return this.menuTarget; - } - - public void setMenuTarget(String menuTarget) { - this.menuTarget = menuTarget; - } - - public String getMenuType() { - return this.menuType; - } - - public void setMenuType(String menuType) { - this.menuType = menuType; - } - - public String getParentCode() { - return this.parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - - public String getParentCodes() { - return this.parentCodes; - } - - public void setParentCodes(String parentCodes) { - this.parentCodes = parentCodes; - } - - public String getPermission() { - return this.permission; - } - - public void setPermission(String permission) { - this.permission = permission; - } - - public String getRemarks() { - return this.remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - - public String getSysCode() { - return this.sysCode; - } - - public void setSysCode(String sysCode) { - this.sysCode = sysCode; - } - - public BigDecimal getTreeLevel() { - return this.treeLevel; - } - - public void setTreeLevel(BigDecimal treeLevel) { - this.treeLevel = treeLevel; - } - - public String getTreeNames() { - return this.treeNames; - } - - public void setTreeNames(String treeNames) { - this.treeNames = treeNames; - } - - public BigDecimal getTreeSort() { - return this.treeSort; - } - - public void setTreeSort(BigDecimal treeSort) { - this.treeSort = treeSort; - } - - public String getTreeSorts() { - return this.treeSorts; - } - - public void setTreeSorts(String treeSorts) { - this.treeSorts = treeSorts; - } - - public String getUpdateBy() { - return this.updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateDate() { - return this.updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public BigDecimal getWeight() { - return this.weight; - } - - public void setWeight(BigDecimal weight) { - this.weight = weight; - } - - // grid tree - public String getId() { - return getMenuCode(); - } - - public SysMenuStatusEnum getStatus() { - return status; - } - - public void setStatus(SysMenuStatusEnum status) { - this.status = status; - } - - public Boolean getTreeLeaf() { - return treeLeaf; - } - - public void setTreeLeaf(Boolean treeLeaf) { - this.treeLeaf = treeLeaf; - } - -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysOfficeEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysOfficeEntity.java deleted file mode 100644 index 79240a1..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysOfficeEntity.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.tamguo.modules.sys.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.annotations.TableName; - - -/** - * The persistent class for the sys_office database table. - * - */ -@TableName(value="sys_office") -public class SysOfficeEntity implements Serializable { - private static final long serialVersionUID = 1L; - public static final String ROOT_OFFICE_CODE = "0"; - public static final String TREE_CODE_OFFICE_SEPARATE = ","; - public static final String TREE_NAME_OFFICE_SEPARATE = "/"; - - @TableId - private String officeCode; - private String address; - private String corpCode; - private String corpName; - private String createBy; - private Date createDate; - private String email; - private String fullName; - private String leader; - private String officeName; - private String officeType; - private String parentCode; - private String parentCodes; - private String phone; - private String remarks; - private String status; - private Boolean treeLeaf; - private BigDecimal treeLevel; - private String treeNames; - private BigDecimal treeSort; - private String treeSorts; - private String updateBy; - private Date updateDate; - private String viewCode; - private String zipCode; - - public SysOfficeEntity() { - } - - public String getOfficeCode() { - return this.officeCode; - } - - public void setOfficeCode(String officeCode) { - this.officeCode = officeCode; - } - - public String getAddress() { - return this.address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCorpCode() { - return this.corpCode; - } - - public void setCorpCode(String corpCode) { - this.corpCode = corpCode; - } - - public String getCorpName() { - return this.corpName; - } - - public void setCorpName(String corpName) { - this.corpName = corpName; - } - - public String getCreateBy() { - return this.createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateDate() { - return this.createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public String getEmail() { - return this.email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getFullName() { - return this.fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public String getLeader() { - return this.leader; - } - - public void setLeader(String leader) { - this.leader = leader; - } - - public String getOfficeName() { - return this.officeName; - } - - public void setOfficeName(String officeName) { - this.officeName = officeName; - } - - public String getOfficeType() { - return this.officeType; - } - - public void setOfficeType(String officeType) { - this.officeType = officeType; - } - - public String getParentCode() { - return this.parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - - public String getParentCodes() { - return this.parentCodes; - } - - public void setParentCodes(String parentCodes) { - this.parentCodes = parentCodes; - } - - public String getPhone() { - return this.phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getRemarks() { - return this.remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public String getStatus() { - return this.status; - } - - public void setStatus(String status) { - this.status = status; - } - - public Boolean getTreeLeaf() { - return this.treeLeaf; - } - - public void setTreeLeaf(Boolean treeLeaf) { - this.treeLeaf = treeLeaf; - } - - public BigDecimal getTreeLevel() { - return this.treeLevel; - } - - public void setTreeLevel(BigDecimal treeLevel) { - this.treeLevel = treeLevel; - } - - public String getTreeNames() { - return this.treeNames; - } - - public void setTreeNames(String treeNames) { - this.treeNames = treeNames; - } - - public BigDecimal getTreeSort() { - return this.treeSort; - } - - public void setTreeSort(BigDecimal treeSort) { - this.treeSort = treeSort; - } - - public String getTreeSorts() { - return this.treeSorts; - } - - public void setTreeSorts(String treeSorts) { - this.treeSorts = treeSorts; - } - - public String getUpdateBy() { - return this.updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateDate() { - return this.updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public String getViewCode() { - return this.viewCode; - } - - public void setViewCode(String viewCode) { - this.viewCode = viewCode; - } - - public String getZipCode() { - return this.zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } - - // grid tree - public String getId() { - return this.getOfficeCode(); - } - -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysPostEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysPostEntity.java deleted file mode 100644 index c6dd35e..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysPostEntity.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.tamguo.modules.sys.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -import com.alibaba.fastjson.annotation.JSONField; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.annotations.TableName; -import com.tamguo.modules.sys.model.enums.SysPostStatusEnum; - - -/** - * The persistent class for the sys_post database table. - * - */ -@TableName(value="sys_post") -public class SysPostEntity extends Model implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId - private String postCode; - private String corpCode; - private String corpName; - private String createBy; - private Date createDate; - private String postName; - private BigDecimal postSort; - private String postType; - private String remarks; - - @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString) - private SysPostStatusEnum status; - private String updateBy; - private Date updateDate; - - public SysPostEntity() { - } - - public String getPostCode() { - return this.postCode; - } - - public void setPostCode(String postCode) { - this.postCode = postCode; - } - - public String getCorpCode() { - return this.corpCode; - } - - public void setCorpCode(String corpCode) { - this.corpCode = corpCode; - } - - public String getCorpName() { - return this.corpName; - } - - public void setCorpName(String corpName) { - this.corpName = corpName; - } - - public String getCreateBy() { - return this.createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateDate() { - return this.createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public String getPostName() { - return this.postName; - } - - public void setPostName(String postName) { - this.postName = postName; - } - - public BigDecimal getPostSort() { - return this.postSort; - } - - public void setPostSort(BigDecimal postSort) { - this.postSort = postSort; - } - - public String getPostType() { - return this.postType; - } - - public void setPostType(String postType) { - this.postType = postType; - } - - public String getRemarks() { - return this.remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public SysPostStatusEnum getStatus() { - return this.status; - } - - public void setStatus(SysPostStatusEnum status) { - this.status = status; - } - - public String getUpdateBy() { - return this.updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateDate() { - return this.updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - @Override - protected Serializable pkVal() { - return getPostCode(); - } - -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleDataScopeEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleDataScopeEntity.java deleted file mode 100644 index 56219d2..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleDataScopeEntity.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.tamguo.modules.sys.model; - -import com.baomidou.mybatisplus.annotations.TableName; - -@TableName(value="sys_role_data_scope") -public class SysRoleDataScopeEntity { - - private String roleCode; - private String ctrlType; - private String ctrlData; - private String ctrlPermi; - - public String getRoleCode() { - return roleCode; - } - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - public String getCtrlType() { - return ctrlType; - } - public void setCtrlType(String ctrlType) { - this.ctrlType = ctrlType; - } - public String getCtrlData() { - return ctrlData; - } - public void setCtrlData(String ctrlData) { - this.ctrlData = ctrlData; - } - public String getCtrlPermi() { - return ctrlPermi; - } - public void setCtrlPermi(String ctrlPermi) { - this.ctrlPermi = ctrlPermi; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleEntity.java deleted file mode 100644 index ef4013d..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleEntity.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.tamguo.modules.sys.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -import com.baomidou.mybatisplus.annotations.TableField; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.annotations.TableName; - - -/** - * The persistent class for the sys_role database table. - * - */ -@TableName(value="sys_role") -public class SysRoleEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId - private String roleCode; - private String corpCode; - private String corpName; - private String createBy; - private Date createDate; - private String dataScope; - private String isSys; - private String remarks; - private String roleName; - private BigDecimal roleSort; - private String roleType; - private String status; - private String updateBy; - private Date updateDate; - private String userType; - - @TableField(exist=false) - private String roleMenuListJson; - @TableField(exist=false) - private String roleDataScopeListJson; - - public SysRoleEntity() { - } - - public String getRoleCode() { - return this.roleCode; - } - - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - - public String getCorpCode() { - return this.corpCode; - } - - public void setCorpCode(String corpCode) { - this.corpCode = corpCode; - } - - public String getCorpName() { - return this.corpName; - } - - public void setCorpName(String corpName) { - this.corpName = corpName; - } - - public String getCreateBy() { - return this.createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateDate() { - return this.createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public String getDataScope() { - return this.dataScope; - } - - public void setDataScope(String dataScope) { - this.dataScope = dataScope; - } - - public String getIsSys() { - return this.isSys; - } - - public void setIsSys(String isSys) { - this.isSys = isSys; - } - - public String getRemarks() { - return this.remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public String getRoleName() { - return this.roleName; - } - - public void setRoleName(String roleName) { - this.roleName = roleName; - } - - public BigDecimal getRoleSort() { - return this.roleSort; - } - - public void setRoleSort(BigDecimal roleSort) { - this.roleSort = roleSort; - } - - public String getRoleType() { - return this.roleType; - } - - public void setRoleType(String roleType) { - this.roleType = roleType; - } - - public String getStatus() { - return this.status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getUpdateBy() { - return this.updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateDate() { - return this.updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public String getUserType() { - return this.userType; - } - - public void setUserType(String userType) { - this.userType = userType; - } - - public String getId() { - return getRoleCode(); - } - - public String getRoleMenuListJson() { - return roleMenuListJson; - } - - public void setRoleMenuListJson(String roleMenuListJson) { - this.roleMenuListJson = roleMenuListJson; - } - - public String getRoleDataScopeListJson() { - return roleDataScopeListJson; - } - - public void setRoleDataScopeListJson(String roleDataScopeListJson) { - this.roleDataScopeListJson = roleDataScopeListJson; - } - -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleMenuEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleMenuEntity.java deleted file mode 100644 index f3cbabb..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysRoleMenuEntity.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.tamguo.modules.sys.model; - -import com.baomidou.mybatisplus.annotations.TableName; - -@TableName(value="sys_role_menu") -public class SysRoleMenuEntity { - - private String roleCode; - private String menuCode; - - public String getRoleCode() { - return roleCode; - } - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - public String getMenuCode() { - return menuCode; - } - public void setMenuCode(String menuCode) { - this.menuCode = menuCode; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserDataScopeEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserDataScopeEntity.java deleted file mode 100644 index 13e20b5..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserDataScopeEntity.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.tamguo.modules.sys.model; - -import com.baomidou.mybatisplus.annotations.TableName; - -@TableName(value="sys_user_data_scope") -public class SysUserDataScopeEntity { - - private String userCode; - private String ctrlType; - private String ctrlData; - private String ctrlPermi; - public String getUserCode() { - return userCode; - } - public void setUserCode(String userCode) { - this.userCode = userCode; - } - public String getCtrlType() { - return ctrlType; - } - public void setCtrlType(String ctrlType) { - this.ctrlType = ctrlType; - } - public String getCtrlData() { - return ctrlData; - } - public void setCtrlData(String ctrlData) { - this.ctrlData = ctrlData; - } - public String getCtrlPermi() { - return ctrlPermi; - } - public void setCtrlPermi(String ctrlPermi) { - this.ctrlPermi = ctrlPermi; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserEntity.java deleted file mode 100644 index 928536c..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserEntity.java +++ /dev/null @@ -1,487 +0,0 @@ -package com.tamguo.modules.sys.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -import com.alibaba.fastjson.annotation.JSONField; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableField; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.annotations.TableName; -import com.tamguo.modules.sys.model.enums.SysUserMgrTypeEnum; -import com.tamguo.modules.sys.model.enums.SysUserStatusEnum; -import com.tamguo.modules.sys.model.enums.SysUserTypeEnum; - - -/** - * The persistent class for the sys_user database table. - * - */ -@TableName(value="sys_user") -public class SysUserEntity extends Model implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId - private String userCode; - private String officeCode; - private String officeName; - private String companyCode; - private String companyName; - private String avatar; - private String corpCode; - private String corpName; - private String createBy; - private Date createDate; - private String email; - private String freezeCause; - private Date freezeDate; - private Date lastLoginDate; - private String lastLoginIp; - private String loginCode; - - @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString) - private SysUserMgrTypeEnum mgrType; - - private String mobile; - private String mobileImei; - private String password; - private String phone; - private Date pwdQuestUpdateDate; - private String pwdQuestion; - @TableField(value="pwd_question_2") - private String pwdQuestion2; - @TableField(value="pwd_question_3") - private String pwdQuestion3; - private String pwdQuestionAnswer; - @TableField(value="pwd_question_answer_2") - private String pwdQuestionAnswer2; - @TableField(value="pwd_question_answer_3") - private String pwdQuestionAnswer3; - private BigDecimal pwdSecurityLevel; - private Date pwdUpdateDate; - private String pwdUpdateRecord; - private String refCode; - private String refName; - private String remarks; - private String sex; - private String sign; - - @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString) - private SysUserStatusEnum status; - - private String updateBy; - private Date updateDate; - private String userName; - private String empName; - - @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString) - private SysUserTypeEnum userType; - - private BigDecimal userWeight; - private String wxOpenid; - private String userNameEn; - - @TableField(exist=false) - private List employeePosts; - @TableField(exist=false) - private String userRoleString; - @TableField(exist=false) - private String userDataScopeListJson; - - public SysUserEntity() { - } - - public String getUserCode() { - return this.userCode; - } - - public void setUserCode(String userCode) { - this.userCode = userCode; - } - - public String getAvatar() { - return this.avatar; - } - - public void setAvatar(String avatar) { - this.avatar = avatar; - } - - public String getCorpCode() { - return this.corpCode; - } - - public void setCorpCode(String corpCode) { - this.corpCode = corpCode; - } - - public String getCorpName() { - return this.corpName; - } - - public void setCorpName(String corpName) { - this.corpName = corpName; - } - - public String getCreateBy() { - return this.createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateDate() { - return this.createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public String getEmail() { - return this.email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getFreezeCause() { - return this.freezeCause; - } - - public void setFreezeCause(String freezeCause) { - this.freezeCause = freezeCause; - } - - public Date getFreezeDate() { - return this.freezeDate; - } - - public void setFreezeDate(Date freezeDate) { - this.freezeDate = freezeDate; - } - - public Date getLastLoginDate() { - return this.lastLoginDate; - } - - public void setLastLoginDate(Date lastLoginDate) { - this.lastLoginDate = lastLoginDate; - } - - public String getLastLoginIp() { - return this.lastLoginIp; - } - - public void setLastLoginIp(String lastLoginIp) { - this.lastLoginIp = lastLoginIp; - } - - public String getLoginCode() { - return this.loginCode; - } - - public void setLoginCode(String loginCode) { - this.loginCode = loginCode; - } - - public String getMobile() { - return this.mobile; - } - - public void setMobile(String mobile) { - this.mobile = mobile; - } - - public String getMobileImei() { - return this.mobileImei; - } - - public void setMobileImei(String mobileImei) { - this.mobileImei = mobileImei; - } - - public String getPassword() { - return this.password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getPhone() { - return this.phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public Date getPwdQuestUpdateDate() { - return this.pwdQuestUpdateDate; - } - - public void setPwdQuestUpdateDate(Date pwdQuestUpdateDate) { - this.pwdQuestUpdateDate = pwdQuestUpdateDate; - } - - public String getPwdQuestion() { - return this.pwdQuestion; - } - - public void setPwdQuestion(String pwdQuestion) { - this.pwdQuestion = pwdQuestion; - } - - public String getPwdQuestion2() { - return this.pwdQuestion2; - } - - public void setPwdQuestion2(String pwdQuestion2) { - this.pwdQuestion2 = pwdQuestion2; - } - - public String getPwdQuestion3() { - return this.pwdQuestion3; - } - - public void setPwdQuestion3(String pwdQuestion3) { - this.pwdQuestion3 = pwdQuestion3; - } - - public String getPwdQuestionAnswer() { - return this.pwdQuestionAnswer; - } - - public void setPwdQuestionAnswer(String pwdQuestionAnswer) { - this.pwdQuestionAnswer = pwdQuestionAnswer; - } - - public String getPwdQuestionAnswer2() { - return this.pwdQuestionAnswer2; - } - - public void setPwdQuestionAnswer2(String pwdQuestionAnswer2) { - this.pwdQuestionAnswer2 = pwdQuestionAnswer2; - } - - public String getPwdQuestionAnswer3() { - return this.pwdQuestionAnswer3; - } - - public void setPwdQuestionAnswer3(String pwdQuestionAnswer3) { - this.pwdQuestionAnswer3 = pwdQuestionAnswer3; - } - - public BigDecimal getPwdSecurityLevel() { - return this.pwdSecurityLevel; - } - - public void setPwdSecurityLevel(BigDecimal pwdSecurityLevel) { - this.pwdSecurityLevel = pwdSecurityLevel; - } - - public Date getPwdUpdateDate() { - return this.pwdUpdateDate; - } - - public void setPwdUpdateDate(Date pwdUpdateDate) { - this.pwdUpdateDate = pwdUpdateDate; - } - - public String getPwdUpdateRecord() { - return this.pwdUpdateRecord; - } - - public void setPwdUpdateRecord(String pwdUpdateRecord) { - this.pwdUpdateRecord = pwdUpdateRecord; - } - - public String getRefCode() { - return this.refCode; - } - - public void setRefCode(String refCode) { - this.refCode = refCode; - } - - public String getRefName() { - return this.refName; - } - - public void setRefName(String refName) { - this.refName = refName; - } - - public String getRemarks() { - return this.remarks; - } - - public void setRemarks(String remarks) { - this.remarks = remarks; - } - - public String getSex() { - return this.sex; - } - - public void setSex(String sex) { - this.sex = sex; - } - - public String getSign() { - return this.sign; - } - - public void setSign(String sign) { - this.sign = sign; - } - - public SysUserStatusEnum getStatus() { - return this.status; - } - - public void setStatus(SysUserStatusEnum status) { - this.status = status; - } - - public String getUpdateBy() { - return this.updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateDate() { - return this.updateDate; - } - - public void setUpdateDate(Date updateDate) { - this.updateDate = updateDate; - } - - public String getUserName() { - return this.userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public BigDecimal getUserWeight() { - return this.userWeight; - } - - public void setUserWeight(BigDecimal userWeight) { - this.userWeight = userWeight; - } - - public String getWxOpenid() { - return this.wxOpenid; - } - - public void setWxOpenid(String wxOpenid) { - this.wxOpenid = wxOpenid; - } - - public String getOfficeCode() { - return officeCode; - } - - public void setOfficeCode(String officeCode) { - this.officeCode = officeCode; - } - - public String getOfficeName() { - return officeName; - } - - public void setOfficeName(String officeName) { - this.officeName = officeName; - } - - public String getCompanyCode() { - return companyCode; - } - - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } - - public String getCompanyName() { - return companyName; - } - - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - - public SysUserMgrTypeEnum getMgrType() { - return mgrType; - } - - public void setMgrType(SysUserMgrTypeEnum mgrType) { - this.mgrType = mgrType; - } - - public String getUserNameEn() { - return userNameEn; - } - - public void setUserNameEn(String userNameEn) { - this.userNameEn = userNameEn; - } - - public List getEmployeePosts() { - return employeePosts; - } - - public void setEmployeePosts(List employeePosts) { - this.employeePosts = employeePosts; - } - - public String getEmpName() { - return empName; - } - - public void setEmpName(String empName) { - this.empName = empName; - } - - public String getUserRoleString() { - return userRoleString; - } - - public void setUserRoleString(String userRoleString) { - this.userRoleString = userRoleString; - } - - public SysUserTypeEnum getUserType() { - return userType; - } - - public void setUserType(SysUserTypeEnum userType) { - this.userType = userType; - } - - public String getUserDataScopeListJson() { - return userDataScopeListJson; - } - - public void setUserDataScopeListJson(String userDataScopeListJson) { - this.userDataScopeListJson = userDataScopeListJson; - } - - @Override - protected Serializable pkVal() { - return getUserCode(); - } - - -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserPostEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserPostEntity.java deleted file mode 100644 index 8b53c93..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserPostEntity.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.tamguo.modules.sys.model; - -import com.baomidou.mybatisplus.annotations.TableName; - -@TableName(value="sys_user_post") -public class SysUserPostEntity { - - private String userCode; - private String postCode; - public String getUserCode() { - return userCode; - } - public void setUserCode(String userCode) { - this.userCode = userCode; - } - public String getPostCode() { - return postCode; - } - public void setPostCode(String postCode) { - this.postCode = postCode; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserRoleEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserRoleEntity.java deleted file mode 100644 index 0d515ef..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysUserRoleEntity.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.tamguo.modules.sys.model; - -import com.baomidou.mybatisplus.annotations.TableName; - -@TableName(value="sys_user_role") -public class SysUserRoleEntity { - - private String userCode; - private String roleCode; - - public String getRoleCode() { - return roleCode; - } - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - public String getUserCode() { - return userCode; - } - public void setUserCode(String userCode) { - this.userCode = userCode; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysAreaCondition.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysAreaCondition.java deleted file mode 100644 index 7313ba2..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysAreaCondition.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.tamguo.modules.sys.model.condition; - -public class SysAreaCondition { - - private String parentCode; - - private Integer pageNo; - private Integer pageSize; - - public Integer getPageNo() { - return pageNo; - } - public void setPageNo(Integer pageNo) { - this.pageNo = pageNo; - } - public Integer getPageSize() { - return pageSize; - } - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - public String getParentCode() { - return parentCode; - } - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysCompanyCondition.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysCompanyCondition.java deleted file mode 100644 index 8e4d149..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysCompanyCondition.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.tamguo.modules.sys.model.condition; - -public class SysCompanyCondition { - - private String parentCode; - private String companyName; - private String fullName; - - public String getCompanyName() { - return companyName; - } - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - public String getFullName() { - return fullName; - } - public void setFullName(String fullName) { - this.fullName = fullName; - } - public String getParentCode() { - return parentCode; - } - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysMenuCondition.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysMenuCondition.java deleted file mode 100644 index 38a6565..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysMenuCondition.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.tamguo.modules.sys.model.condition; - -public class SysMenuCondition { - - private String parentCode; - - private Integer pageNo; - private Integer pageSize; - - public Integer getPageNo() { - return pageNo; - } - public void setPageNo(Integer pageNo) { - this.pageNo = pageNo; - } - public Integer getPageSize() { - return pageSize; - } - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - public String getParentCode() { - return parentCode; - } - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysOfficeCondition.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysOfficeCondition.java deleted file mode 100644 index 30b4c03..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysOfficeCondition.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.tamguo.modules.sys.model.condition; - -public class SysOfficeCondition { - - private String parentCode; - - public String getParentCode() { - return parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysPostCondition.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysPostCondition.java deleted file mode 100644 index 25b97f7..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysPostCondition.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.tamguo.modules.sys.model.condition; - -public class SysPostCondition { - - private String code; - private String name; - private String postType; - private String status; - - private Integer pageNo; - private Integer pageSize; - - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getPostType() { - return postType; - } - public void setPostType(String postType) { - this.postType = postType; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public Integer getPageNo() { - return pageNo; - } - public void setPageNo(Integer pageNo) { - this.pageNo = pageNo; - } - public Integer getPageSize() { - return pageSize; - } - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysRoleCondition.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysRoleCondition.java deleted file mode 100644 index 6c0926e..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysRoleCondition.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.tamguo.modules.sys.model.condition; - -public class SysRoleCondition { - - private Integer pageNo; - private Integer pageSize; - - public Integer getPageNo() { - return pageNo; - } - public void setPageNo(Integer pageNo) { - this.pageNo = pageNo; - } - public Integer getPageSize() { - return pageSize; - } - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysUserCondition.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysUserCondition.java deleted file mode 100644 index a87e171..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/condition/SysUserCondition.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.tamguo.modules.sys.model.condition; - -public class SysUserCondition { - - private Integer pageNo; - private Integer pageSize; - - private String loginCode; - private String userName; - private String email; - private String mobile; - private String phone; - private String refName; - private String officeName; - private String officeCode; - private String companyCode; - private String companyName; - private String postCode; - private String status; - private String userType; - private String mgrType; - - private String orderBy; - - public Integer getPageNo() { - return pageNo; - } - public void setPageNo(Integer pageNo) { - this.pageNo = pageNo; - } - public Integer getPageSize() { - return pageSize; - } - public void setPageSize(Integer pageSize) { - this.pageSize = pageSize; - } - public String getLoginCode() { - return loginCode; - } - public void setLoginCode(String loginCode) { - this.loginCode = loginCode; - } - public String getUserName() { - return userName; - } - public void setUserName(String userName) { - this.userName = userName; - } - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - public String getMobile() { - return mobile; - } - public void setMobile(String mobile) { - this.mobile = mobile; - } - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - public String getRefName() { - return refName; - } - public void setRefName(String refName) { - this.refName = refName; - } - public String getOfficeName() { - return officeName; - } - public void setOfficeName(String officeName) { - this.officeName = officeName; - } - public String getOfficeCode() { - return officeCode; - } - public void setOfficeCode(String officeCode) { - this.officeCode = officeCode; - } - public String getCompanyCode() { - return companyCode; - } - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } - public String getCompanyName() { - return companyName; - } - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - public String getPostCode() { - return postCode; - } - public void setPostCode(String postCode) { - this.postCode = postCode; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public String getUserType() { - return userType; - } - public void setUserType(String userType) { - this.userType = userType; - } - public String getOrderBy() { - return orderBy; - } - public void setOrderBy(String orderBy) { - this.orderBy = orderBy; - } - public String getMgrType() { - return mgrType; - } - public void setMgrType(String mgrType) { - this.mgrType = mgrType; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysCompanyStatusEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysCompanyStatusEnum.java deleted file mode 100644 index a12d577..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysCompanyStatusEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysCompanyStatusEnum implements IEnum { - NORMAL("normal", "正常"), - DELETE("delete", "删除"), - DISABLED("disabled" , "停用"); - - private String value; - private String desc; - - SysCompanyStatusEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysMenuStatusEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysMenuStatusEnum.java deleted file mode 100644 index b9af8c0..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysMenuStatusEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysMenuStatusEnum implements IEnum { - NORMAL("0", "正常"), - DELETE("1" , "删除"), - DISABLED("2" , "停用"); - - private String value; - private String desc; - - SysMenuStatusEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysOfficeStatusEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysOfficeStatusEnum.java deleted file mode 100644 index 806cb1c..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysOfficeStatusEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysOfficeStatusEnum implements IEnum { - NORMAL("normal", "正常"), - DELETE("delete", "删除"), - DISABLED("disabled" , "停用"); - - private String value; - private String desc; - - SysOfficeStatusEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysOfficeTypeEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysOfficeTypeEnum.java deleted file mode 100644 index ede3be8..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysOfficeTypeEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysOfficeTypeEnum implements IEnum { - PROVINCE("province", "省级公司"), - CITY("city", "市级公司"), - DEPARTMENT("department" , "部门"); - - private String value; - private String desc; - - SysOfficeTypeEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysPostStatusEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysPostStatusEnum.java deleted file mode 100644 index f71da42..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysPostStatusEnum.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysPostStatusEnum implements IEnum { - NORMAL("normal", "正常"), - DISABLED("disable" , "停用"); - - private String value; - private String desc; - - SysPostStatusEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysPostTypeEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysPostTypeEnum.java deleted file mode 100644 index 63c02e4..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysPostTypeEnum.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysPostTypeEnum implements IEnum { - GAOGUAN("gaoguan", "高管"), - ZHONGCENG("zhongceng", "中层"), - JICENG("jiceng" , "基层"), - QITA("qita" , "其他"); - - private String value; - private String desc; - - SysPostTypeEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public static SysPostTypeEnum getPostType(String postType) { - if("gaoguan".equals(postType)) { - return SysPostTypeEnum.GAOGUAN; - }else if("zhongceng".equals(postType)) { - return SysPostTypeEnum.ZHONGCENG; - }else if("jiceng".equals(postType)) { - return SysPostTypeEnum.JICENG; - }else if("qita".equals(postType)) { - return SysPostTypeEnum.QITA; - } - return null; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserMgrTypeEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserMgrTypeEnum.java deleted file mode 100644 index 017159f..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserMgrTypeEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysUserMgrTypeEnum implements IEnum { - NONE_ADMIN("0", "非系统管理员"), - SYSTEM_ADMIN("1", "系统管理员"), - SEC_ADMIN("2" , "二级管理员"); - - private String value; - private String desc; - - SysUserMgrTypeEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserStatusEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserStatusEnum.java deleted file mode 100644 index a997289..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserStatusEnum.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysUserStatusEnum implements IEnum { - NORMAL("0", "正常"), - DELETE("1" , "删除"), - DISABLED("2" , "禁用"), - LOCKED("3", "锁定"),; - - private String value; - private String desc; - - SysUserStatusEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserTypeEnum.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserTypeEnum.java deleted file mode 100644 index 8883ca5..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/enums/SysUserTypeEnum.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.tamguo.modules.sys.model.enums; - -import java.io.Serializable; -import com.baomidou.mybatisplus.enums.IEnum; - -/** - * 用户状态 - */ -public enum SysUserTypeEnum implements IEnum { - EMPLOYEE("employee", "雇员"), - NONE("none", "系统"); - - private String value; - private String desc; - - SysUserTypeEnum(final String value, final String desc) { - this.value = value; - this.desc = desc; - } - - public Serializable getValue() { - return this.value; - } - - public String getDesc(){ - return this.desc; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysAreaService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysAreaService.java deleted file mode 100644 index f2c789c..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysAreaService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.tamguo.modules.sys.service; - -import java.util.List; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysAreaEntity; -import com.tamguo.modules.sys.model.condition.SysAreaCondition; - -public interface ISysAreaService extends IService{ - - List listData(SysAreaCondition condition); - - JSONArray treeData(String excludeId); - - /** 保存地区*/ - void save(SysAreaEntity area); - - /** 修改地区*/ - void update(SysAreaEntity area); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysCompanyService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysCompanyService.java deleted file mode 100644 index c6a8664..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysCompanyService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.tamguo.modules.sys.service; - -import java.util.List; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysCompanyEntity; -import com.tamguo.modules.sys.model.condition.SysCompanyCondition; - -public interface ISysCompanyService extends IService{ - - /** 公司树形结构*/ - JSONArray treeData(String excludeId); - - /** 查询公司列表*/ - List listData(SysCompanyCondition condition); - - /** 根据ID查询公司*/ - SysCompanyEntity selectByCode(String code); - - /** 新建公司*/ - void save(SysCompanyEntity company); - - /** 修改公司*/ - void update(SysCompanyEntity company); -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysMenuService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysMenuService.java deleted file mode 100644 index 0bfca67..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysMenuService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.tamguo.modules.sys.service; - -import java.util.List; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysMenuEntity; -import com.tamguo.modules.sys.model.condition.SysMenuCondition; - -public interface ISysMenuService extends IService{ - - /** 列表数据*/ - List listData(SysMenuCondition condition); - - /** 树形结构*/ - JSONArray treeData(String excludeId); - - /** 新增菜单*/ - void save(SysMenuEntity menu); - - /** 修改菜单*/ - void update(SysMenuEntity menu); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysOfficeService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysOfficeService.java deleted file mode 100644 index 8af421c..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysOfficeService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.tamguo.modules.sys.service; - -import java.util.List; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysOfficeEntity; -import com.tamguo.modules.sys.model.condition.SysOfficeCondition; - -public interface ISysOfficeService extends IService{ - - List listData(SysOfficeCondition condition); - - JSONArray treeData(String excludeId); - - void save(SysOfficeEntity office); - - void update(SysOfficeEntity office); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysPostService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysPostService.java deleted file mode 100644 index 5063daf..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysPostService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.tamguo.modules.sys.service; - -import com.baomidou.mybatisplus.plugins.Page; -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysPostEntity; -import com.tamguo.modules.sys.model.condition.SysPostCondition; - -public interface ISysPostService extends IService{ - - /** 查询列表*/ - Page listData(SysPostCondition condition); - - /** 添加数据*/ - void add(SysPostEntity post); - - /** 修改数据*/ - void update(SysPostEntity post); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysRoleDataScopeService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysRoleDataScopeService.java deleted file mode 100644 index 0ee8d4a..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysRoleDataScopeService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.tamguo.modules.sys.service; - -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysRoleDataScopeEntity; - -public interface ISysRoleDataScopeService extends IService{ - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysRoleService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysRoleService.java deleted file mode 100644 index 67dc6d3..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysRoleService.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.tamguo.modules.sys.service; - -import java.util.Map; -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.plugins.Page; -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysRoleEntity; -import com.tamguo.modules.sys.model.condition.SysRoleCondition; - -public interface ISysRoleService extends IService{ - - /** 列表查询*/ - Page listData(SysRoleCondition condition); - - /** 属性菜单*/ - Map menuTreeData(String roleCode); - - /** 分配功能权限*/ - void allowMenuPermission(SysRoleEntity role); - - /** 授权数据权限*/ - void allowDataScope(SysRoleEntity role); - - /** 角色树形结构*/ - JSONArray treeDate(String userType); - - /** 修改角色*/ - void update(SysRoleEntity role); - - /** 新增角色*/ - void save(SysRoleEntity role); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysUserService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysUserService.java deleted file mode 100644 index e080ee4..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysUserService.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.tamguo.modules.sys.service; - -import java.util.List; -import com.baomidou.mybatisplus.plugins.Page; -import com.baomidou.mybatisplus.service.IService; -import com.tamguo.modules.sys.model.SysMenuEntity; -import com.tamguo.modules.sys.model.SysUserDataScopeEntity; -import com.tamguo.modules.sys.model.SysUserEntity; -import com.tamguo.modules.sys.model.SysUserRoleEntity; -import com.tamguo.modules.sys.model.condition.SysUserCondition; -import com.tamguo.modules.sys.model.enums.SysUserMgrTypeEnum; -import com.tamguo.modules.sys.utils.Result; - -public interface ISysUserService extends IService{ - - public SysUserEntity queryByLoginCode(String loginCode); - - public Page listData(SysUserCondition condition); - - /** 用户岗位*/ - public String queryUserPostByUserCode(String userCode); - - /** 检查登录账号*/ - public Boolean checkLoginCode(String oldLoginCode , String loginCode); - - /** 更新用户信息*/ - public void update(SysUserEntity user); - - /** 添加用户信息*/ - public void save(SysUserEntity user); - - /** 分配角色*/ - public void allowUserRole(SysUserEntity user); - - /** 获取用户角色*/ - public List findUserRole(String userCode); - - /** 用户数据权限*/ - public List selectUserDataScope(String userCode); - - /** 保存用户数据权限*/ - public void saveUserDataScope(SysUserEntity user); - - /** 保存用户数据权限*/ - public void saveUserDataScope(SysUserEntity user , SysUserMgrTypeEnum mgrType); - - /** 停用账号*/ - public Result disable(String userCode); - - /** 激活账号*/ - public Result enable(String userCode); - - /** 删除用户*/ - public Result delete(String userCode); - - /** 添加管理员*/ - public void saveAdmin(SysUserEntity user); - - /** 修改管理员*/ - public void updateAdmin(SysUserEntity user); - - /** 当前用户权限菜单*/ - public List findUserMenuList(); -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysAreaServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysAreaServiceImpl.java deleted file mode 100644 index 041b310..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysAreaServiceImpl.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.tamguo.modules.sys.service.impl; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.mapper.Condition; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.tamguo.modules.sys.dao.SysAreaMapper; -import com.tamguo.modules.sys.model.SysAreaEntity; -import com.tamguo.modules.sys.model.condition.SysAreaCondition; -import com.tamguo.modules.sys.model.enums.SysAreaStatusEnum; -import com.tamguo.modules.sys.service.ISysAreaService; -import com.tamguo.modules.sys.utils.ShiroUtils; - -@Service -public class SysAreaServiceImpl extends ServiceImpl implements ISysAreaService{ - - @Autowired - SysAreaMapper sysAreaMapper; - - @Override - public List listData(SysAreaCondition condition) { - return sysAreaMapper.listData(condition); - } - - @SuppressWarnings("unchecked") - @Override - public JSONArray treeData(String excludeId) { - List areaList = null; - if(StringUtils.isEmpty(excludeId)) { - areaList = sysAreaMapper.selectList(Condition.EMPTY); - }else { - areaList = sysAreaMapper.selectList(Condition.create().notLike("parent_codes", excludeId).ne("area_code", excludeId)); - } - return turnZTreeData(areaList); - } - - private JSONArray turnZTreeData(List areaList) { - if(areaList != null) { - JSONArray nodes = new JSONArray(); - for(int i=0 ; i 0) { - area.setTreeLeaf(false); - }else { - area.setTreeLeaf(true); - } - return area; - } - - @SuppressWarnings("unchecked") - @Transactional(readOnly=false) - @Override - public void update(SysAreaEntity area) { - SysAreaEntity entity = sysAreaMapper.selectById(area.getAreaCode()); - - String oldParentCode = entity.getParentCode(); - - entity.setUpdateBy(ShiroUtils.getUserCode()); - entity.setUpdateDate(new Date()); - entity.setParentCode(area.getParentCode()); - entity.setAreaName(area.getAreaName()); - entity.setAreaType(area.getAreaType()); - entity.setTreeSort(area.getTreeSort()); - entity.setRemarks(area.getRemarks()); - - this.handleTreeData(area); - sysAreaMapper.updateById(entity); - - // 更新旧的节点 - Integer count = sysAreaMapper.selectCount(Condition.create().eq("parent_code", oldParentCode).ne("area_code", oldParentCode)); - if(count == 0) { - SysAreaEntity oldParentOffice = sysAreaMapper.selectById(oldParentCode); - oldParentOffice.setTreeLeaf(true); - sysAreaMapper.updateById(oldParentOffice); - } - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java deleted file mode 100644 index 78cf5e6..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.tamguo.modules.sys.service.impl; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.mapper.Condition; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.tamguo.modules.sys.dao.SysCompanyMapper; -import com.tamguo.modules.sys.model.SysCompanyEntity; -import com.tamguo.modules.sys.model.condition.SysCompanyCondition; -import com.tamguo.modules.sys.service.ISysCompanyService; -import com.tamguo.modules.sys.utils.ShiroUtils; - -@Service -public class SysCompanyServiceImpl extends ServiceImpl implements ISysCompanyService { - - @Autowired - private SysCompanyMapper sysCompanyMapper; - - @SuppressWarnings("unchecked") - @Override - public JSONArray treeData(String excludeId) { - List companyList = null; - if(StringUtils.isEmpty(excludeId)) { - companyList = sysCompanyMapper.selectList(Condition.EMPTY); - }else { - companyList = sysCompanyMapper.selectList(Condition.create().notLike("parent_codes", excludeId).ne("company_code", excludeId)); - } - return turnZTreeData(companyList); - } - - @Override - public List listData(SysCompanyCondition condition) { - return sysCompanyMapper.listData(condition); - } - - @Override - public SysCompanyEntity selectByCode(String code) { - return sysCompanyMapper.selectByCode(code); - } - - private JSONArray turnZTreeData(List companyList) { - if(companyList != null) { - JSONArray nodes = new JSONArray(); - for(int i=0 ; i 0) { - company.setTreeLeaf(false); - }else { - company.setTreeLeaf(true); - } - return company; - } - - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysMenuServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysMenuServiceImpl.java deleted file mode 100644 index 25a6854..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysMenuServiceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.tamguo.modules.sys.service.impl; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.mapper.Condition; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.tamguo.modules.sys.dao.SysMenuMapper; -import com.tamguo.modules.sys.model.SysMenuEntity; -import com.tamguo.modules.sys.model.condition.SysMenuCondition; -import com.tamguo.modules.sys.model.enums.SysMenuStatusEnum; -import com.tamguo.modules.sys.service.ISysMenuService; -import com.tamguo.modules.sys.utils.ShiroUtils; - -@Service -public class SysMenuServiceImpl extends ServiceImpl implements ISysMenuService { - - @Autowired - SysMenuMapper sysMenuMapper; - - @Override - public List listData(SysMenuCondition condition) { - return sysMenuMapper.listData(condition); - } - - @Transactional(readOnly=true) - @SuppressWarnings("unchecked") - @Override - public JSONArray treeData(String excludeId) { - List menus = null; - if(StringUtils.isEmpty(excludeId)) { - menus = sysMenuMapper.selectList(Condition.EMPTY); - }else { - menus = sysMenuMapper.selectList(Condition.create().notLike("parent_codes", excludeId).ne("menu_code", excludeId)); - } - return turnZTreeData(menus); - } - - private JSONArray turnZTreeData(List menus) { - if(menus != null) { - JSONArray nodes = new JSONArray(); - for(int i=0 ; i 0) { - menu.setTreeLeaf(false); - }else { - menu.setTreeLeaf(true); - } - return menu; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysOfficeServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysOfficeServiceImpl.java deleted file mode 100644 index faba318..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysOfficeServiceImpl.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.tamguo.modules.sys.service.impl; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.mapper.Condition; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.tamguo.modules.sys.dao.SysOfficeMapper; -import com.tamguo.modules.sys.model.SysOfficeEntity; -import com.tamguo.modules.sys.model.condition.SysOfficeCondition; -import com.tamguo.modules.sys.service.ISysOfficeService; -import com.tamguo.modules.sys.utils.ShiroUtils; - -@Service -public class SysOfficeServiceImpl extends ServiceImpl implements ISysOfficeService { - - @Autowired - private SysOfficeMapper sysOfficeMapper; - - @Override - public List listData(SysOfficeCondition condition) { - return sysOfficeMapper.listData(condition); - } - - @SuppressWarnings("unchecked") - @Override - public JSONArray treeData(String excludeId) { - List officeList = null; - if(StringUtils.isEmpty(excludeId)) { - officeList = sysOfficeMapper.selectList(Condition.EMPTY); - }else { - officeList = sysOfficeMapper.selectList(Condition.create().notLike("parent_codes", excludeId).ne("office_code", excludeId)); - } - return turnZTreeData(officeList); - } - - private JSONArray turnZTreeData(List companyList) { - if(companyList != null) { - JSONArray nodes = new JSONArray(); - for(int i=0 ; i 0) { - office.setTreeLeaf(false); - }else { - office.setTreeLeaf(true); - } - return office; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysPostServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysPostServiceImpl.java deleted file mode 100644 index 16b2655..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysPostServiceImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.tamguo.modules.sys.service.impl; - -import java.util.Date; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.baomidou.mybatisplus.plugins.Page; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.tamguo.modules.sys.dao.SysPostMapper; -import com.tamguo.modules.sys.model.SysPostEntity; -import com.tamguo.modules.sys.model.condition.SysPostCondition; -import com.tamguo.modules.sys.model.enums.SysPostStatusEnum; -import com.tamguo.modules.sys.service.ISysPostService; -import com.tamguo.modules.sys.utils.ShiroUtils; - -@Service -public class SysPostServiceImpl extends ServiceImpl implements ISysPostService{ - - @Autowired - private SysPostMapper sysPostMapper; - - @Override - public Page listData(SysPostCondition condition) { - Page page = new Page<>(condition.getPageNo(), condition.getPageSize()); - return page.setRecords(sysPostMapper.listData(condition , page)); - } - - @Transactional(readOnly=false) - @Override - public void add(SysPostEntity post) { - post.setCreateDate(new Date()); - post.setCreateBy(ShiroUtils.getUserCode()); - post.setUpdateBy(ShiroUtils.getUserCode()); - post.setUpdateDate(new Date()); - post.setStatus(SysPostStatusEnum.NORMAL); - sysPostMapper.insert(post); - } - - @Transactional(readOnly=false) - @Override - public void update(SysPostEntity post) { - SysPostEntity entity = sysPostMapper.selectById(post.getPostCode()); - entity.setUpdateDate(new Date()); - entity.setUpdateBy(ShiroUtils.getUserCode()); - entity.setPostName(post.getPostName()); - entity.setPostCode(post.getPostCode()); - entity.setPostType(post.getPostType()); - entity.setPostSort(post.getPostSort()); - entity.setRemarks(post.getRemarks()); - - sysPostMapper.updateById(entity); - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysRoleDataScopeServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysRoleDataScopeServiceImpl.java deleted file mode 100644 index 55cdf35..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysRoleDataScopeServiceImpl.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.tamguo.modules.sys.service.impl; - -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.tamguo.modules.sys.dao.SysRoleDataScopeMapper; -import com.tamguo.modules.sys.model.SysRoleDataScopeEntity; -import com.tamguo.modules.sys.service.ISysRoleDataScopeService; - -@Service -public class SysRoleDataScopeServiceImpl extends ServiceImpl implements ISysRoleDataScopeService{ - - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysRoleServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysRoleServiceImpl.java deleted file mode 100644 index 5703f95..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysRoleServiceImpl.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.tamguo.modules.sys.service.impl; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.mapper.Condition; -import com.baomidou.mybatisplus.plugins.Page; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.tamguo.modules.sys.dao.SysMenuMapper; -import com.tamguo.modules.sys.dao.SysRoleDataScopeMapper; -import com.tamguo.modules.sys.dao.SysRoleMapper; -import com.tamguo.modules.sys.dao.SysRoleMenuMapper; -import com.tamguo.modules.sys.model.SysMenuEntity; -import com.tamguo.modules.sys.model.SysRoleDataScopeEntity; -import com.tamguo.modules.sys.model.SysRoleEntity; -import com.tamguo.modules.sys.model.SysRoleMenuEntity; -import com.tamguo.modules.sys.model.condition.SysRoleCondition; -import com.tamguo.modules.sys.service.ISysRoleService; -import com.tamguo.modules.sys.utils.ShiroUtils; - -@Service -public class SysRoleServiceImpl extends ServiceImpl implements ISysRoleService { - - @Autowired - private SysRoleMapper sysRoleMapper; - @Autowired - private SysMenuMapper sysMenuMapper; - @Autowired - private SysRoleMenuMapper sysRoleMenuMapper; - @Autowired - private SysRoleDataScopeMapper sysRoleDataScopeMapper; - - @Transactional(readOnly=true) - @Override - public Page listData(SysRoleCondition condition) { - Page page = new Page<>(condition.getPageNo(), condition.getPageSize()); - return page.setRecords(sysRoleMapper.listData(condition , page)); - } - - @SuppressWarnings("unchecked") - @Override - public Map menuTreeData(String roleCode) { - List menus = sysMenuMapper.selectList(Condition.create().eq("is_show", "1")); - List roleMenus = sysMenuMapper.selectMenuByRoleId(roleCode); - - JSONObject result = new JSONObject(); - - JSONObject menuInfo = transformZTree(menus); - result.put("menuMap", menuInfo); - result.put("roleMenuList", roleMenus); - - return result; - } - - private JSONObject transformZTree(List menus) { - JSONObject result = new JSONObject(); - if(menus != null) { - JSONArray nodes = new JSONArray(); - for(int i=0 ; i       "); - if(!StringUtils.isEmpty(menu.getMenuHref())) { - node.put("name", menu.getMenuName() + "     "+menu.getMenuHref()+"  "); - }else if(!StringUtils.isEmpty(menu.getPermission())) { - node.put("name", menu.getMenuName() + "     "+menu.getPermission()+"  "); - } - node.put("pId", menu.getParentCode()); - node.put("id", menu.getMenuCode()); - node.put("title", menu.getMenuName()); - nodes.add(node); - } - result.put("default", nodes); - } - return result; - } - - @Transactional(readOnly=false) - @SuppressWarnings("unchecked") - @Override - public void allowMenuPermission(SysRoleEntity role) { - // 删除关联菜单 - sysRoleMenuMapper.delete(Condition.create().eq("role_code", role.getRoleCode())); - - if(!StringUtils.isEmpty(role.getRoleMenuListJson())) { - JSONArray roleMenus = JSONArray.parseArray(role.getRoleMenuListJson()); - for(int i=0 ; i roles) { - if(roles != null) { - JSONArray entitys = new JSONArray(); - for(int i=0 ; i implements ISysUserService{ - - @Autowired - public SysUserMapper sysUserMapper; - @Autowired - public SysUserPostMapper sysUserPostMapper; - @Autowired - public SysUserRoleMapper sysUserRoleMapper; - @Autowired - public ISysRoleService iSysRoleService; - @Autowired - public SysUserDataScopeMapper sysUserDataScopeMapper; - @Autowired - public SysRoleMenuMapper sysRoleMenuMapper; - @Autowired - public SysMenuMapper sysMenuMapper; - - @Transactional(readOnly=false) - @Override - public SysUserEntity queryByLoginCode(String loginCode) { - SysUserEntity condition = new SysUserEntity(); - condition.setLoginCode(loginCode); - return sysUserMapper.selectOne(condition); - } - - @Transactional(readOnly=false) - @Override - public Page listData(SysUserCondition condition) { - Page page = new Page<>(condition.getPageNo() , condition.getPageSize()); - return page.setRecords(sysUserMapper.listData(condition , page)); - } - - @SuppressWarnings("unchecked") - @Override - public String queryUserPostByUserCode(String userCode) { - Condition condition = Condition.create(); - condition.eq("user_code", userCode); - List userPostList = sysUserPostMapper.selectList(condition); - - List postCodes = new LinkedList<>(); - for(int i=0 ; i userList = sysUserMapper.selectList(condition); - return CollectionUtils.isEmpty(userList); - } - - @SuppressWarnings("unchecked") - @Transactional(readOnly=false) - @Override - public void update(SysUserEntity user) { - SysUserEntity entity = sysUserMapper.selectById(user.getUserCode()); - entity.setOfficeCode(user.getOfficeCode()); - entity.setOfficeName(user.getOfficeName()); - entity.setCompanyCode(user.getCompanyCode()); - entity.setCompanyName(user.getCompanyName()); - entity.setLoginCode(user.getLoginCode()); - entity.setUserName(user.getUserName()); - entity.setEmail(user.getEmail()); - entity.setMobile(user.getMobile()); - entity.setPhone(user.getPhone()); - entity.setUserWeight(user.getUserWeight()); - entity.setRefName(user.getRefName()); - entity.setUserNameEn(user.getUserNameEn()); - entity.setRemarks(user.getRemarks()); - sysUserMapper.updateById(entity); - - // 删除记录 - sysUserPostMapper.delete(Condition.create().eq("user_code", user.getUserCode())); - // 处理岗位 - List employeePosts = user.getEmployeePosts(); - for(int i=0 ; i employeePosts = user.getEmployeePosts(); - for(int i=0 ; i findUserRole(String userCode) { - return sysUserRoleMapper.selectList(Condition.create().eq("user_code", userCode)); - } - - @SuppressWarnings("unchecked") - @Transactional(readOnly=true) - @Override - public List selectUserDataScope(String userCode) { - return sysUserDataScopeMapper.selectList(Condition.create().eq("user_code", userCode)); - } - - @SuppressWarnings("unchecked") - @Transactional(readOnly=false) - @Override - public void saveUserDataScope(SysUserEntity user) { - // 删除之前的数据权限 - sysUserDataScopeMapper.delete(Condition.create().eq("user_code", user.getUserCode())); - - if(!StringUtils.isEmpty(user.getUserDataScopeListJson())) { - JSONArray dataScopeList = JSONArray.parseArray(user.getUserDataScopeListJson()); - for(int i=0 ; i findUserMenuList() { - String userCode = ShiroUtils.getUserCode(); - if(SystemConstant.SYSTEM_USER_CODE.equals(userCode)) { - List menus = sysMenuMapper.selectList(Condition.create().orderAsc(java.util.Arrays.asList("tree_sort"))); - return (menus); - } - List menus = new ArrayList<>(); - Set menuIds = new HashSet<>(); - List userRoleList = sysUserRoleMapper.selectList(Condition.create().eq("user_code", userCode)); - for(SysUserRoleEntity userRole : userRoleList) { - List roleMenuList = sysRoleMenuMapper.selectList(Condition.create().eq("role_code", userRole.getRoleCode())); - for(SysRoleMenuEntity roleMenu : roleMenuList) { - SysMenuEntity menu = sysMenuMapper.selectById(roleMenu.getMenuCode()); - if(!menuIds.contains(menu.getMenuCode())) { - menus.add(menu); - } - menuIds.add(menu.getMenuCode()); - } - } - return menus; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/AbstractRunningLogHandler.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/AbstractRunningLogHandler.java deleted file mode 100644 index cfda82b..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/AbstractRunningLogHandler.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.InterruptedIOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -public abstract class AbstractRunningLogHandler implements LogHandler { - - private static Method getStackTraceMethod; - private static Method getClassNameMethod; - private static Method getMethodNameMethod; - private static Method getFileNameMethod; - private static Method getLineNumberMethod; - - static { - try { - Class[] noArgs = null; - getStackTraceMethod = Throwable.class.getMethod("getStackTrace", noArgs); - Class stackTraceElementClass = Class.forName("java.lang.StackTraceElement"); - getClassNameMethod = stackTraceElementClass.getMethod("getClassName", noArgs); - getMethodNameMethod = stackTraceElementClass.getMethod("getMethodName", noArgs); - getFileNameMethod = stackTraceElementClass.getMethod("getFileName", noArgs); - getLineNumberMethod = stackTraceElementClass.getMethod("getLineNumber", noArgs); - } catch (ClassNotFoundException ex) { - LogDebug.debug("will use pre-JDK 1.4 methods to determine location."); - } catch (NoSuchMethodException ex) { - LogDebug.debug("will use pre-JDK 1.4 methods to determine location."); - } - } - - /** - * 获得指定class的StackTraceElement - * - * @param t - * @param fqnOfCallingClass - * - * @return - */ - protected StackTraceElement getRunningStackTrace(Throwable t, String fqnOfCallingClass) { - if (getLineNumberMethod != null) { - try { - Object[] noArgs = null; - Object[] elements = (Object[]) getStackTraceMethod.invoke(t, noArgs); - for (int i = elements.length - 1; i >= 0; i--) { - String thisClass = (String) getClassNameMethod.invoke(elements[i], noArgs); - if (fqnOfCallingClass.equals(thisClass)) { - // 执行class名称 - String className = fqnOfCallingClass; - // 执行方法名称 - String methodName = (String) getMethodNameMethod.invoke(elements[i], noArgs); - // 执行class文件名称 - String fileName = (String) getFileNameMethod.invoke(elements[i], noArgs); - // 执行到行号 - int lineNumber = ((Integer) getLineNumberMethod.invoke(elements[i], noArgs)).intValue(); - return new StackTraceElement(className, methodName, fileName, lineNumber); - } - } - } catch (IllegalAccessException ex) { - LogDebug.debug("failed using JDK 1.4 methods", ex); - } catch (InvocationTargetException ex) { - if (ex.getTargetException() instanceof InterruptedException - || ex.getTargetException() instanceof InterruptedIOException) { - Thread.currentThread().interrupt(); - } - LogDebug.debug("failed using JDK 1.4 methods", ex); - } catch (RuntimeException ex) { - LogDebug.debug("failed using JDK 1.4 methods", ex); - } - } - return this.createDefaultStackTrace(); - } - - /** - * 创建默认StackTraceElement - * - * @return - */ - private StackTraceElement createDefaultStackTrace() { - return new StackTraceElement(this.getClass().getName(), "log", this.getClass().getName(), 0); - } - - @Override - public void info(String msg, String fqnOfCallingClass) { - } - - @Override - public void info(String msg, Throwable t, String fqnOfCallingClass) { - } - - @Override - public void error(String msg, String fqnOfCallingClass) { - } - - @Override - public void error(String msg, Throwable t, String fqnOfCallingClass) { - } - - @Override - public void debug(String msg, String fqnOfCallingClass) { - } - - @Override - public void debug(String msg, Throwable t, String fqnOfCallingClass) { - } - - @Override - public void warning(String msg, String fqnOfCallingClass) { - } - - @Override - public void warning(String msg, Throwable t, String fqnOfCallingClass) { - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/CException.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/CException.java deleted file mode 100644 index f06ed68..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/CException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class CException extends RuntimeException { - - private static final long serialVersionUID = 6401592364022805815L; - - public CException() { - super(); - } - - public CException(String message, Throwable cause) { - super(message, cause); - } - - public CException(String message) { - super(message); - } - - public CException(Throwable cause) { - super(cause); - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/DateUtil.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/DateUtil.java deleted file mode 100644 index 6ecf88c..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/DateUtil.java +++ /dev/null @@ -1,524 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -public final class DateUtil { - - /** - * 正常日期格式化模板. - */ - private static final SimpleDateFormat NORMAL_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - private static final SimpleDateFormat NORMAL_DATE_FORMAT_YY_MM_DD = new SimpleDateFormat("yyyy-MM-dd"); - private static final SimpleDateFormat NORMAL_DATE_FORMAT_YY_MM_DD_ = new SimpleDateFormat("yyyyMMdd"); - - private static final SimpleDateFormat NORMAL_DATE_FORMAT_YYMMDDHHMISS = new SimpleDateFormat("yyyyMMddHHmmss"); - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24) - */ - public static String dateFormatYYMMDD(long date) { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date(date * 1000)); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(20111124) - */ - - public static String getCurrentDateStr() { - return NORMAL_DATE_FORMAT_YY_MM_DD_.format(new Date()); - } - - public static String getCurrentDateYYYYMMDDStr() { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date()); - } - - public static String getNextDayYYYYMMDDStr() { - Calendar cal = Calendar.getInstance(); - try { - cal.setTime(NORMAL_DATE_FORMAT_YY_MM_DD.parse(getCurrentTime())); - cal.add(Calendar.DATE, 1); - return NORMAL_DATE_FORMAT_YY_MM_DD.format(cal.getTime()); - } catch (ParseException e) { - e.printStackTrace(); - } - return null; - } - - public static long getNextDayYYYYMMDDLong() { - Calendar cal = Calendar.getInstance(); - try { - cal.setTime(NORMAL_DATE_FORMAT_YY_MM_DD.parse(getCurrentTime())); - cal.add(Calendar.DATE, 1); - return cal.getTimeInMillis(); - } catch (ParseException e) { - e.printStackTrace(); - } - return 0l; - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24 16:46:38) - */ - public static String dateFormat(long date) { - return NORMAL_DATE_FORMAT.format(new Date(date * 1000)); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24) - */ - public static String dateFormatYYYYMMDD(long date) { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date(date * 1000)); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24 16:46:38) - */ - - public static String dateFormat(Date date) { - return NORMAL_DATE_FORMAT.format(date); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(20111124164638) - */ - - public static String dateFormathhmmss(Date date) { - return NORMAL_DATE_FORMAT_YYMMDDHHMISS.format(date); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(20111124164638) - */ - - public static String dateFormatYYYYMMDD(Date date) { - return NORMAL_DATE_FORMAT_YY_MM_DD_.format(date); - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期(2011-11-24 16:46:38) - */ - - public static String getCurrentTime() { - return NORMAL_DATE_FORMAT_YY_MM_DD.format(new Date()); - } - - /** - * 获取当前距1970年1月1日秒数. - * - * @return 当前距1970年1月1日秒数. - */ - public static Long getTime() { - return new Date().getTime() / 1000; - } - - /** - * 获取当前距1970年1月1日秒数. - * - * @return 获取最近一周的秒数. - */ - public static long getLastWeekTime() { - return new Date().getTime() / 1000 - 7 * 24 * 60 * 60; - } - - /** - * 获取当前距1970年1月1日秒数. - * - * @return 获取最近一个月的秒数. - */ - public static long getLastMonthTime() { - return new Date().getTime() / 1000 - 30 * 24 * 60 * 60; - } - - /** - * 获取某年某月第一天. - * - * @return 日期格式如:2011-12-31 00:00:00 . - */ - public static long getFirstDayOfMonth(String year, String month) { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.YEAR, Integer.valueOf(year)); - cal.set(Calendar.MONTH, Integer.valueOf(month) - 1); - cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DATE)); - return parseDate(NORMAL_DATE_FORMAT_YY_MM_DD.format(cal.getTime()) + " 00:00:00").getTime() / 1000; - } - - /** - * 获取某年某月最后一天. - * - * @return 日期格式如:2011-12-31 23:59:59 . - */ - public static long getLastDayOfMonth(String year, String month) { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.YEAR, Integer.valueOf(year)); - cal.set(Calendar.MONTH, Integer.valueOf(month) - 1); - cal.set(Calendar.DAY_OF_MONTH, 1); - int value = cal.getActualMaximum(Calendar.DAY_OF_MONTH); - cal.set(Calendar.DAY_OF_MONTH, value); - return parseDate(NORMAL_DATE_FORMAT_YY_MM_DD.format(cal.getTime()) + " 23:59:59").getTime() / 1000; - } - - /** - * 解析字符串为Date. - * - * @param dateString - * 日期字符串 例如 2011-12-17 17:41:18.843 CST. - * @return 解析后的日期类型.若解析出错则返回null - */ - public static Date parseDate(String dateStr) { - try { - return NORMAL_DATE_FORMAT.parse(dateStr); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 正常日期格式化. - * - * @param date - * 日期距离1970年1月1日秒数 - * @return 格式化后的日期() - */ - - public static long parseLong(String date) { - return parseDate(date).getTime() / 1000; - } - - /** - * 日期格式转换为字符串格式 - * - * @param date - * @return 格式化后的日期字符串 - */ - public static String parseString(Date date) { - - return NORMAL_DATE_FORMAT_YY_MM_DD.format(date); - } - - public static long getLastDayStartTime(long daytime) { - Calendar todayStart = Calendar.getInstance(); - todayStart.setTimeInMillis(daytime * 1000); - todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return todayStart.getTimeInMillis() / 1000; - } - - public static long getLastDayEndTime(long daytime) { - Calendar todayEnd = Calendar.getInstance(); - todayEnd.setTimeInMillis(daytime * 1000); - todayEnd.add(Calendar.DAY_OF_YEAR, -1); - todayEnd.set(Calendar.HOUR_OF_DAY, 23); - todayEnd.set(Calendar.MINUTE, 59); - todayEnd.set(Calendar.SECOND, 59); - todayEnd.set(Calendar.MILLISECOND, 999); - return todayEnd.getTimeInMillis() / 1000; - } - - public static long getTime(long time) { - Calendar timeCalendar = Calendar.getInstance(); - Calendar nowCalendar = Calendar.getInstance(); - timeCalendar.setTimeInMillis(time * 1000); - timeCalendar.set(Calendar.HOUR_OF_DAY, nowCalendar.get(Calendar.HOUR_OF_DAY)); - timeCalendar.set(Calendar.MINUTE, nowCalendar.get(Calendar.MINUTE)); - timeCalendar.set(Calendar.SECOND, nowCalendar.get(Calendar.SECOND)); - timeCalendar.set(Calendar.MILLISECOND, nowCalendar.get(Calendar.MILLISECOND)); - return timeCalendar.getTimeInMillis() / 1000; - } - - public static long getStartTime(long daytime) { - Calendar todayStart = Calendar.getInstance(); - todayStart.setTimeInMillis(daytime * 1000); - // todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return todayStart.getTime().getTime() / 1000; - } - - public static long getEndTime(long daytime) { - Calendar todayEnd = Calendar.getInstance(); - todayEnd.setTimeInMillis(daytime * 1000); - // todayEnd.add(Calendar.DAY_OF_YEAR, -1); - todayEnd.set(Calendar.HOUR_OF_DAY, 23); - todayEnd.set(Calendar.MINUTE, 59); - todayEnd.set(Calendar.SECOND, 59); - todayEnd.set(Calendar.MILLISECOND, 999); - return todayEnd.getTimeInMillis() / 1000; - } - - /** - * 比较俩日期是否是同一天 - * - * @param d1 - * @param d2 - * @return - */ - public static boolean compareSameDate(Date d1, Date d2) { - Calendar c1 = Calendar.getInstance(); - c1.setTime(d1); - Calendar c2 = Calendar.getInstance(); - c2.setTime(d2); - boolean isSameYear = c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR); - boolean isSameMonth = isSameYear && c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH); - boolean isSameDate = isSameMonth && c1.get(Calendar.DAY_OF_MONTH) == c2.get(Calendar.DAY_OF_MONTH); - return isSameDate; - } - - /** - * 当月的第一天距1970年1月1日秒数. - * - * @param date - * @return long - * @author mengxm - */ - public static final long firstMonthDayTime() { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.DAY_OF_MONTH, 1); - return cal.getTime().getTime() / 1000; - } - - /** - * 根据指定格式解析时间 - * - * @param dateString - * @param fmtString - * @return Date - * @author mengxm - */ - public static final Date parse(String dateString, String fmtString) { - Date date = null; - try { - DateFormat format = new SimpleDateFormat(fmtString); - date = format.parse(dateString); - } catch (ParseException e) { - e.printStackTrace(); - } - return date; - } - - /** 比较提现前后时间间隔秒数 */ - public static boolean getDatePoor(Date endDate, Date nowDate) { - - // 获得两个时间的毫秒时间差异 - System.out.println(endDate.getTime()); - System.out.println(nowDate.getTime()); - long diff = (endDate.getTime() - nowDate.getTime()) / 1000; - if (diff < 30) { - return true; - } - return false; - } - - /** - * 当前时间加几天 - * - * @param day - * 天数 - * @return - */ - public static long currentDateAddDay(int day) { - Calendar cal = Calendar.getInstance(); - try { - cal.setTime(NORMAL_DATE_FORMAT_YY_MM_DD.parse(getCurrentTime())); - cal.add(Calendar.DATE, day); // add N days - return cal.getTimeInMillis() / 1000; - } catch (ParseException e) { - e.printStackTrace(); - } - return 0l; - } - - public static long dateAddDay(long dateLong, int day) { - Calendar cal = Calendar.getInstance(); - Date d = new Date(dateLong * 1000); - cal.setTime(d); - cal.add(Calendar.DATE, day); - return cal.getTimeInMillis() / 1000; - } - - /** - * 计算两个日期之间相差的天数 - * - * @param smdate - * 较小的时间 - * @param bdate - * 较大的时间 - * @return 相差天数 - * @throws ParseException - */ - public static int daysBetween(Date smdate, Date bdate) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - long between_days = 0L; - try { - smdate = sdf.parse(sdf.format(smdate)); - bdate = sdf.parse(sdf.format(bdate)); - Calendar cal = Calendar.getInstance(); - cal.setTime(smdate); - long time1 = cal.getTimeInMillis(); - cal.setTime(bdate); - long time2 = cal.getTimeInMillis(); - between_days = (time2 - time1) / (1000 * 3600 * 24); - } catch (ParseException e) { - e.printStackTrace(); - } - return Integer.parseInt(String.valueOf(between_days)); - } - - /** 日期转换为自定义格式输出 */ - public static String DateToString(Date date, String formatType) { - if (date == null) { - return null; - } - if (formatType == null || "".equals(formatType)) { - return null; - } - String dateStr = ""; - try { - SimpleDateFormat sdf = new SimpleDateFormat(formatType); - dateStr = sdf.format(date); - return dateStr; - } catch (Exception e) { - return null; - } - } - - public static long getStartTimeCurrentDay() { - Calendar todayStart = Calendar.getInstance(); - // todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return todayStart.getTime().getTime() / 1000; - } - - public static long getEndTimeCurrentDay() { - Calendar todayStart = Calendar.getInstance(); - // todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 23); - todayStart.set(Calendar.MINUTE, 59); - todayStart.set(Calendar.SECOND, 59); - todayStart.set(Calendar.MILLISECOND, 59); - return todayStart.getTime().getTime() / 1000; - } - - /** 日期转换为自定义格式输出 */ - public static String fomatDate(Date date, String format) { - if (date == null) { - return ""; - } - if (format == null || "".equals(format)) { - return ""; - } - try { - SimpleDateFormat sdf = new SimpleDateFormat(format); - return sdf.format(date); - } catch (Exception e) { - e.printStackTrace(); - return ""; - - } - } - - public static String getLastDayFmtYYYYMMDD() { - Calendar todayStart = Calendar.getInstance(); - todayStart.add(Calendar.DAY_OF_YEAR, -1); - todayStart.set(Calendar.HOUR_OF_DAY, 0); - todayStart.set(Calendar.MINUTE, 0); - todayStart.set(Calendar.SECOND, 0); - todayStart.set(Calendar.MILLISECOND, 0); - return NORMAL_DATE_FORMAT_YY_MM_DD_.format(todayStart.getTime()); - } - - /** - * @Title: getDateFormat - * @Description: 日期格式化 yyyy-MM-dd - * @param str - * @return String - */ - public static String getDateFormat(String str) { - return dateFormatYYMMDD(Long.parseLong(str)); - } - - /** - * @Title: getTimeFormat - * @Description: 时间格式化 yyyy-MM-dd HH:mm:ss - * @param str - * @return String - */ - public static String getTimeFormat(String str) { - return dateFormat(Long.parseLong(str)); - } - - public static void main(String[] args) { - - System.out.println(dateFormat(1441036802)); - System.out.println(getFirstDayOfMonth("2015", "9")); - System.out.println(getLastDayOfMonth("2015", "8")); - System.out.println(dateFormat(getLastMonthTime())); - System.out.println(dateFormat(getLastWeekTime())); - System.out.println(parseLong("2017-01-01 00:00:00")); - System.out.println(getTime()); - System.out.println(dateFormat(1451624155)); - System.out.println(parse("20151222", "yyyyMMdd")); - Calendar c = Calendar.getInstance(); - Date nowDate = c.getTime(); - c.set(Calendar.MINUTE, -1); - Date endDate = c.getTime(); - System.out.println("nowDate--" + nowDate + ";endDate--" + endDate); - System.out.println(getDatePoor(nowDate, endDate)); - System.out.println(dateFormatYYYYMMDD(new Date())); - - System.out.println("args = [" + DateUtil.currentDateAddDay(0) + "]"); - System.out.println("args = [" + DateUtil.parse("2016-01-19", "yyyy-MM-dd").getTime() + "]"); - - System.out.println(getTime()); - System.out.println(getEndTimeCurrentDay()); - - System.out.println(getEndTimeCurrentDay() - getTime()); - - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/DateUtils.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/DateUtils.java deleted file mode 100644 index 6f94a90..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/DateUtils.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -public class DateUtils { - public static final String DEFAULT_PATTERN = "yyyy-MM-dd"; - - public static String getOneDayFromNow(int day, String pattern) { - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - cal.add(Calendar.DAY_OF_MONTH, day); - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - return sdf.format(cal.getTime()); - } - - public static String getOneDayFromNow(int day) { - return DateUtils.getOneDayFromNow(day, DEFAULT_PATTERN); - } - - /** - * 计算两个日期之间相差的天数 - * - * @param smdate - * 较小的时间 - * @param bdate - * 较大的时间 - * @return 相差天数 - * @throws ParseException - * @throws java.text.ParseException - */ - public static int daysBetween(Date smdate, Date bdate) - throws ParseException { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - smdate = sdf.parse(sdf.format(smdate)); - bdate = sdf.parse(sdf.format(bdate)); - Calendar cal = Calendar.getInstance(); - cal.setTime(smdate); - long time1 = cal.getTimeInMillis(); - cal.setTime(bdate); - long time2 = cal.getTimeInMillis(); - long between_days = (time2 - time1) / (1000 * 3600 * 24); - - return Integer.parseInt(String.valueOf(between_days)); - } - - public static void main(String[] args) throws ParseException { - System.out.println(daysBetween(null, null)); - } - - /** - * 英文简写(默认)如:2010-12-01 - */ - public static String FORMAT_SHORT = "yyyy-MM-dd"; - /** - * 英文全称 如:2010-12-01 23:15:06 - */ - public static String FORMAT_LONG = "yyyy-MM-dd HH:mm:ss"; - /** - * 精确到毫秒的完整时间 如:yyyy-MM-dd HH:mm:ss.S - */ - public static String FORMAT_FULL = "yyyy-MM-dd HH:mm:ss.S"; - /** - * 中文简写 如:2010年12月01日 - */ - public static String FORMAT_SHORT_CN = "yyyy年MM月dd"; - /** - * 中文全称 如:2010年12月01日 23时15分06秒 - */ - public static String FORMAT_LONG_CN = "yyyy年MM月dd日 HH时mm分ss秒"; - /** - * 精确到毫秒的完整中文时间 - */ - public static String FORMAT_FULL_CN = "yyyy年MM月dd日 HH时mm分ss秒SSS毫秒"; - - /** - * 获得默认的 date pattern - */ - public static String getDatePattern() { - return FORMAT_LONG; - } - - /** - * 根据预设格式返回当前日期 - * - * @return - */ - public static String getNow() { - return format(new Date()); - } - - /** - * 根据用户格式返回当前日期 - * - * @param format - * @return - */ - public static String getNow(String format) { - return format(new Date(), format); - } - - /** - * 使用预设格式格式化日期 - * - * @param date - * @return - */ - public static String format(Date date) { - return format(date, getDatePattern()); - } - - /** - * 使用用户格式格式化日期 - * - * @param date - * 日期 - * @param pattern - * 日期格式 - * @return - */ - public static String format(Date date, String pattern) { - String returnValue = ""; - if (date != null) { - SimpleDateFormat df = new SimpleDateFormat(pattern); - returnValue = df.format(date); - } - return (returnValue); - } - - /** - * 使用用户格式格式化时间戳 - * - * @param timestamp - * 时间戳 - * @param pattern - * 日期格式 - * @return - */ - public static String format(String timestamp, String pattern) { - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - return sdf.format(new Date(Long.parseLong(timestamp))); - } - - /** - * 使用预设格式提取字符串日期 - * - * @param strDate - * 日期字符串 - * @return - */ - public static Date parse(String strDate) { - return parse(strDate, getDatePattern()); - } - - /** - * 使用用户格式提取字符串日期 - * - * @param strDate - * 日期字符串 - * @param pattern - * 日期格式 - * @return - */ - public static Date parse(String strDate, String pattern) { - SimpleDateFormat df = new SimpleDateFormat(pattern); - try { - return df.parse(strDate); - } catch (ParseException e) { - e.printStackTrace(); - return null; - } - } - - /** - * 在日期上增加数个整月 - * - * @param date - * 日期 - * @param n - * 要增加的月数 - * @return - */ - public static Date addMonth(Date date, int n) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(Calendar.MONTH, n); - return cal.getTime(); - } - - /** - * 在日期上增加天数 - * - * @param date - * 日期 - * @param n - * 要增加的天数 - * @return - */ - public static Date addDay(Date date, int n) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(Calendar.DATE, n); - return cal.getTime(); - } - - /** - * 获取时间戳 - */ - public static String getTimeString() { - SimpleDateFormat df = new SimpleDateFormat(FORMAT_FULL); - Calendar calendar = Calendar.getInstance(); - return df.format(calendar.getTime()); - } - - /** - * 获取日期年份 - * - * @param date - * 日期 - * @return - */ - public static String getYear(Date date) { - return format(date).substring(0, 4); - } - - /** - * 按默认格式的字符串距离今天的天数 - * - * @param date - * 日期字符串 - * @return - */ - public static int countDays(String date) { - long t = Calendar.getInstance().getTime().getTime(); - Calendar c = Calendar.getInstance(); - c.setTime(parse(date)); - long t1 = c.getTime().getTime(); - return (int) (t / 1000 - t1 / 1000) / 3600 / 24; - } - - /** - * 按用户格式字符串距离今天的天数 - * - * @param date - * 日期字符串 - * @param format - * 日期格式 - * @return - */ - public static int countDays(String date, String format) { - long t = Calendar.getInstance().getTime().getTime(); - Calendar c = Calendar.getInstance(); - c.setTime(parse(date, format)); - long t1 = c.getTime().getTime(); - return (int) (t / 1000 - t1 / 1000) / 3600 / 24; - } - - public static String timeFormat(Date date, String format, Boolean flag, int beforeDay, int nowDay) { - if(date == null) { - date = new Date(); - } - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - if(flag) { - cal.add(Calendar.DATE,-30); - } else { - cal.add(Calendar.DATE,0); - } - SimpleDateFormat sdf = new SimpleDateFormat(format); - return sdf.format(cal.getTime()); - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ExceptionSupport.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ExceptionSupport.java deleted file mode 100644 index b5763eb..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ExceptionSupport.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.tamguo.modules.sys.utils; - -/** - * 统一异常处理 日志处理 - * - */ -public class ExceptionSupport { - - private final static Result failResult = Result.failResult("500"); - private static LogHandler handler = new Log4jHandler(); - - private final static String LOG_INFO_PREFIX = "--info>> "; - private final static String LOG_ERROR_PREFIX = "--error>> "; - - public static Result resolverResult(String methodInfo, Class clazz, Exception e) { - if(e instanceof CException) { - handler.info(formatInfoLevelMsg(methodInfo, e.getMessage()), clazz.getName()); - return Result.failResult(e.getMessage()); - } - handler.error(formatErrorLevelMsg(methodInfo), e, clazz.getName()); - return failResult; - } - - private static String formatInfoLevelMsg(String methodInfo, String infoMsg) { - return LOG_INFO_PREFIX + methodInfo + ": " + infoMsg; - } - - private static String formatErrorLevelMsg(String methodInfo) { - return LOG_ERROR_PREFIX + methodInfo; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/IdGen.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/IdGen.java deleted file mode 100644 index be66574..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/IdGen.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class IdGen -{ - private long workerId; - private long datacenterId; - private long sequence = 0L; - private long twepoch = 1288834974657L; - private long workerIdBits = 5L; - private long datacenterIdBits = 5L; - private long maxWorkerId = -1L ^ (-1L << workerIdBits); - private long maxDatacenterId = -1L ^ (-1L << datacenterIdBits); - private long sequenceBits = 12L; - private long workerIdShift = sequenceBits; - private long datacenterIdShift = sequenceBits + workerIdBits; - private long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; - private long sequenceMask = -1L ^ (-1L << sequenceBits); - private long lastTimestamp = -1L; - private String suffix; - private boolean flag; - - private static class IdGenHolder { - private static final IdGen instance = new IdGen(); - } - - public static IdGen get(){ - return IdGenHolder.instance; - } - - /** - * 获取字符串拼接id - * @param suffix 字符串 - * @param flag true:前缀 false:后缀 - * @return - */ - public static IdGen get(String suffix,boolean flag){ - if(suffix == null || suffix.trim().length() == 0) - return IdGenHolder.instance; - else{ - return new IdGen(suffix,flag); - } - } - - - public IdGen() { - this(0L, 0L); - } - - public IdGen(String suffix,boolean flag){ - this.suffix = suffix; - this.flag = flag; - } - - public IdGen(long workerId, long datacenterId) { - if (workerId > maxWorkerId || workerId < 0) { - throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId)); - } - if (datacenterId > maxDatacenterId || datacenterId < 0) { - throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId)); - } - this.workerId = workerId; - this.datacenterId = datacenterId; - } - - public synchronized String nextId() { - long timestamp = timeGen(); - 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; - } - lastTimestamp = timestamp; - - long serialNumber = ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift) - | (workerId << workerIdShift) | sequence; - - return (suffix == null || suffix.trim().length() == 0) ? serialNumber+"" : (flag ? (new StringBuffer()).append(suffix).append(serialNumber).toString() : (new StringBuffer()).append(serialNumber).append(suffix).toString()); - } - - protected long tilNextMillis(long lastTimestamp) { - long timestamp = timeGen(); - while (timestamp <= lastTimestamp) { - timestamp = timeGen(); - } - return timestamp; - } - - protected long timeGen() { - return System.currentTimeMillis(); - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Log4jHandler.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Log4jHandler.java deleted file mode 100644 index 9b5f6c5..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Log4jHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.event.Level; - -public class Log4jHandler extends AbstractRunningLogHandler { - - private static final Logger logger = LoggerFactory.getLogger(Log4jHandler.class); - - @Override - public void info(String msg, String fqnOfCallingClass) { - logger.info(fqnOfCallingClass, Level.INFO, msg, null); - } - - @Override - public void info(String msg, Throwable t, String fqnOfCallingClass) { - logger.info(fqnOfCallingClass, Level.INFO, msg, t); - } - - @Override - public void error(String msg, String fqnOfCallingClass) { - logger.error(fqnOfCallingClass, Level.ERROR, msg, null); - } - - @Override - public void error(String msg, Throwable t, String fqnOfCallingClass) { - logger.error(fqnOfCallingClass, Level.ERROR, msg, t); - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/LogDebug.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/LogDebug.java deleted file mode 100644 index 05917b1..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/LogDebug.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class LogDebug { - - private final static String DEBUG_LOG_KEY = "-- LogHandler: "; - - public static void debug(String msg) { - System.err.println(DEBUG_LOG_KEY + msg); - } - - public static void debug(String msg, Throwable t) { - System.err.println(DEBUG_LOG_KEY + msg); - if (t != null) - t.printStackTrace(System.err); - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/LogHandler.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/LogHandler.java deleted file mode 100644 index a6c8dc8..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/LogHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public interface LogHandler { - - public void info(String msg, String fqnOfCallingClass); - - public void info(String msg, Throwable t, String fqnOfCallingClass); - - public void error(String msg, String fqnOfCallingClass); - - public void error(String msg, Throwable t, String fqnOfCallingClass); - - public void debug(String msg, String fqnOfCallingClass); - - public void debug(String msg, Throwable t, String fqnOfCallingClass); - - public void warning(String msg, String fqnOfCallingClass); - - public void warning(String msg, Throwable t, String fqnOfCallingClass); - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ObjectUtil.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ObjectUtil.java deleted file mode 100644 index e9d0d3b..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ObjectUtil.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -public class ObjectUtil extends SerializeTranscoder { - @Override - public byte[] serialize(Object value) { - if (value == null) { - throw new NullPointerException("Can't serialize null"); - } - byte[] result = null; - ByteArrayOutputStream bos = null; - ObjectOutputStream os = null; - try { - bos = new ByteArrayOutputStream(); - os = new ObjectOutputStream(bos); - os.writeObject(value); - os.close(); - bos.close(); - result = bos.toByteArray(); - } catch (IOException e) { - throw new IllegalArgumentException("Non-serializable object", e); - } finally { - close(os); - close(bos); - } - return result; - } - - @Override - public Object deserialize(byte[] in) { - Object result = null; - ByteArrayInputStream bis = null; - ObjectInputStream is = null; - try { - if (in != null) { - bis = new ByteArrayInputStream(in); - is = new ObjectInputStream(bis); - result = is.readObject(); - is.close(); - bis.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } finally { - close(is); - close(bis); - } - return result; - } - - public static boolean equals(Object o1, Object o2) { - - if (o1 == o2) { - return true; - } else if (o1 == null || o2 == null) { - return false; - } else { - return o1.equals(o2); - } - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/RequestHelper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/RequestHelper.java deleted file mode 100644 index 739342b..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/RequestHelper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class RequestHelper { - private static Logger logger = LoggerFactory.getLogger(RequestHelper.class); - - /** - * 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址; - * - * @param request - * @return - * @throws IOException - */ - public final static String getIpAddress(HttpServletRequest request) { - // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址 - String ip = request.getHeader("X-Forwarded-For"); - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_CLIENT_IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_X_FORWARDED_FOR"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - } else if (ip.length() > 15) { - String[] ips = ip.split(","); - for (int index = 0; index < ips.length; index++) { - String strIp = (String) ips[index]; - if (!("unknown".equalsIgnoreCase(strIp))) { - ip = strIp; - break; - } - } - } - if (logger.isInfoEnabled()) { - logger.info("getIpAddress(HttpServletRequest) - Proxy-Client-IP - String ip=" + ip); - } - return ip; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Result.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Result.java deleted file mode 100644 index 5492e63..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Result.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class Result implements Serializable { - - private static final long serialVersionUID = -1651614836984397356L; - - private int code; - - private Object result; - - private String message; - - public static final int SUCCESS_CODE = 0; - - public static final int FAIL_CODE = 1; - - private Result() { - } - - private Result(int code, Object result, String message) { - this.code = code; - this.result = result; - this.message = message; - } - - /** - * 成功响应 - * - * @param result - * @return - */ - public static Result successResult(Object result) { - return result(SUCCESS_CODE, result, ""); - } - - public static Result successResult(Object records, Long recordSum, Long rowsOfPage) { - return successResult(records, recordSum, rowsOfPage, null); - } - - public static Result successResult(Object records, Long recordSum, Long rowsOfPage, Object userData) { - Map result = resultOfList(records, recordSum, rowsOfPage, userData); - - return successResult(result); - } - - public static Map resultOfList(Object records, Long recordSum, Long rowsOfPage) { - return resultOfList(records, recordSum, rowsOfPage, null); - } - - public static Map resultOfList(Object Obj, Long records, Long rowsOfPage, Object userData) { - Map result = new HashMap(); - result.put("rows", Obj); - result.put("records", records); - result.put("total", rowsOfPage); - if (null != userData) { - result.put("userdata", userData); - } - ; - return result; - } - - public static Map jqGridResult(List list, long totalCount, int pageSize, int currPage, - int totalPage) { - Map result = new HashMap(); - result.put("list", list); - result.put("count", totalCount); - result.put("next", currPage == totalPage ? currPage : currPage + 1); - result.put("prev", currPage == 1 ? 1 : currPage - 1); - result.put("first", 1); - result.put("last", totalPage); - result.put("pageSize", pageSize); - result.put("pageNo", currPage); - return result; - } - - /** - * 失败响应 - * - * @param errorMsg - * @return - */ - public static Result failResult(String errorMsg) { - return result(FAIL_CODE, "", errorMsg); - } - - public static Result result(int code, Object result, String message) { - Result res = new Result(code, result, message); - return res; - } - - public int getCode() { - return code; - } - - public Object getResult() { - return result; - } - - public String getMessage() { - return message; - } - -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/SerializeTranscoder.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/SerializeTranscoder.java deleted file mode 100644 index 4a11f39..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/SerializeTranscoder.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.Closeable; - -public abstract class SerializeTranscoder { - - public abstract byte[] serialize(Object value); - - public abstract Object deserialize(byte[] in); - - public void close(Closeable closeable) { - if (closeable != null) { - try { - closeable.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ShaEncrypt.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ShaEncrypt.java deleted file mode 100644 index 517a270..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/ShaEncrypt.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -public class ShaEncrypt { - - /** - * 传入文本内容,返回 SHA-256 串 - * - * @param strText - * @return - */ - public static String SHA256(final String strText) { - return SHA(strText, "SHA-256"); - } - - /** - * 传入文本内容,返回 SHA-512 串 - * - * @param strText - * @return - */ - public static String SHA512(final String strText) { - return SHA(strText, "SHA-512"); - } - - /** - * 字符串 SHA 加密 - * - * @param strSourceText - * @return - */ - private static String SHA(final String strText, final String strType) { - // 返回值 - String strResult = null; - - // 是否是有效字符串 - if (strText != null && strText.length() > 0) { - try { - // SHA 加密开始 - // 创建加密对象 并傳入加密類型 - MessageDigest messageDigest = MessageDigest.getInstance(strType); - // 传入要加密的字符串 - messageDigest.update(strText.getBytes()); - // 得到 byte 類型结果 - byte byteBuffer[] = messageDigest.digest(); - - // 將 byte 轉換爲 string - StringBuffer strHexString = new StringBuffer(); - // 遍歷 byte buffer - for (int i = 0; i < byteBuffer.length; i++) { - String hex = Integer.toHexString(0xff & byteBuffer[i]); - if (hex.length() == 1) { - strHexString.append('0'); - } - strHexString.append(hex); - } - // 得到返回結果 - strResult = strHexString.toString(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - } - - return strResult; - } -} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Status.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Status.java deleted file mode 100644 index c731d24..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Status.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public enum Status { - SUCCESS , ERROR -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/SystemConstant.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/SystemConstant.java deleted file mode 100644 index acf648d..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/SystemConstant.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.tamguo.modules.sys.utils; - -public class SystemConstant { - - /** 初始密码*/ - public static final String INIT_PASSWORD = "123456"; - - /** 验证码常数*/ - public static final String KAPTCHA_SESSION_KEY = "KAPTCHA_SESSION_KEY"; - - /** 验证码常数*/ - public static final String SYSTEM_USER_CODE = "system"; -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Uploader.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Uploader.java deleted file mode 100644 index 3c559d3..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/Uploader.java +++ /dev/null @@ -1,260 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.*; -import java.text.SimpleDateFormat; -import java.util.*; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.fileupload.*; -import org.apache.commons.fileupload.FileUploadBase.InvalidContentTypeException; -import org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException; -import org.apache.commons.fileupload.util.*; -import org.apache.commons.fileupload.servlet.*; -import org.apache.commons.fileupload.FileItemIterator; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; - -import javax.servlet.http.HttpServletRequest; -/** - * UEditor文件上传辅助类 - * - */ -public class Uploader { - // 输出文件地址 - private String url = ""; - // 上传文件名 - private String fileName = ""; - // 状态 - private String state = ""; - // 文件类型 - private String type = ""; - // 原始文件名 - private String originalName = ""; - // 文件大小 - private long size = 0; - - private HttpServletRequest request = null; - private String title = ""; - - // 保存路径 - private String savePath = "upload"; - // 文件允许格式 - private String[] allowFiles = { ".rar", ".doc", ".docx", ".zip", ".pdf",".txt", ".swf", ".wmv", ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; - // 文件大小限制,单位KB - private int maxSize = 10000; - - private HashMap errorInfo = new HashMap(); - - public Uploader(HttpServletRequest request) { - this.request = request; - HashMap tmp = this.errorInfo; - tmp.put("SUCCESS", "SUCCESS"); //默认成功 - tmp.put("NOFILE", "未包含文件上传域"); - tmp.put("TYPE", "不允许的文件格式"); - tmp.put("SIZE", "文件大小超出限制"); - tmp.put("ENTYPE", "请求类型ENTYPE错误"); - tmp.put("REQUEST", "上传请求异常"); - tmp.put("IO", "IO异常"); - tmp.put("DIR", "目录创建失败"); - tmp.put("UNKNOWN", "未知错误"); - - } - - public void upload() throws Exception { - boolean isMultipart = ServletFileUpload.isMultipartContent(this.request); - if (!isMultipart) { - this.state = this.errorInfo.get("NOFILE"); - return; - } - DiskFileItemFactory dff = new DiskFileItemFactory(); - String savePath = this.getFolder(this.savePath); - dff.setRepository(new File(savePath)); - try { - ServletFileUpload sfu = new ServletFileUpload(dff); - sfu.setSizeMax(this.maxSize * 1024); - sfu.setHeaderEncoding("utf-8"); - FileItemIterator fii = sfu.getItemIterator(this.request); - while (fii.hasNext()) { - FileItemStream fis = fii.next(); - if (!fis.isFormField()) { - this.originalName = fis.getName().substring(fis.getName().lastIndexOf(System.getProperty("file.separator")) + 1); - if (!this.checkFileType(this.originalName)) { - this.state = this.errorInfo.get("TYPE"); - continue; - } - this.fileName = this.getName(this.originalName); - this.type = this.getFileExt(this.fileName); - this.url = savePath + "/" + this.fileName; - BufferedInputStream in = new BufferedInputStream(fis.openStream()); - File file = new File(this.getPhysicalPath(this.url)); - FileOutputStream out = new FileOutputStream( file ); - BufferedOutputStream output = new BufferedOutputStream(out); - Streams.copy(in, output, true); - this.state=this.errorInfo.get("SUCCESS"); - this.size = file.length(); - //UE中只会处理单张上传,完成后即退出 - break; - } else { - String fname = fis.getFieldName(); - //只处理title,其余表单请自行处理 - if(!fname.equals("pictitle")){ - continue; - } - BufferedInputStream in = new BufferedInputStream(fis.openStream()); - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - StringBuffer result = new StringBuffer(); - while (reader.ready()) { - result.append((char)reader.read()); - } - this.title = new String(result.toString().getBytes(),"utf-8"); - reader.close(); - - } - } - } catch (SizeLimitExceededException e) { - this.state = this.errorInfo.get("SIZE"); - } catch (InvalidContentTypeException e) { - this.state = this.errorInfo.get("ENTYPE"); - } catch (FileUploadException e) { - this.state = this.errorInfo.get("REQUEST"); - } catch (Exception e) { - this.state = this.errorInfo.get("UNKNOWN"); - } - } - - /** - * 接受并保存以base64格式上传的文件 - * @param fieldName - */ - public void uploadBase64(String fieldName){ - String savePath = this.getFolder(this.savePath); - String base64Data = this.request.getParameter(fieldName); - this.fileName = this.getName("test.png"); - this.url = savePath + "/" + this.fileName; - try { - File outFile = new File(this.getPhysicalPath(this.url)); - OutputStream ro = new FileOutputStream(outFile); - byte[] b = Base64.decodeBase64(base64Data); - for (int i = 0; i < b.length; ++i) { - if (b[i] < 0) { - b[i] += 256; - } - } - ro.write(b); - ro.flush(); - ro.close(); - this.state=this.errorInfo.get("SUCCESS"); - } catch (Exception e) { - this.state = this.errorInfo.get("IO"); - } - } - - /** - * 文件类型判断 - * - * @param fileName - * @return - */ - private boolean checkFileType(String fileName) { - Iterator type = Arrays.asList(this.allowFiles).iterator(); - while (type.hasNext()) { - String ext = type.next(); - if (fileName.toLowerCase().endsWith(ext)) { - return true; - } - } - return false; - } - - /** - * 获取文件扩展名 - * - * @return string - */ - private String getFileExt(String fileName) { - return fileName.substring(fileName.lastIndexOf(".")); - } - - /** - * 依据原始文件名生成新文件名 - * @return - */ - private String getName(String fileName) { - Random random = new Random(); - return this.fileName = "" + random.nextInt(10000) - + System.currentTimeMillis() + this.getFileExt(fileName); - } - - /** - * 根据字符串创建本地目录 并按照日期建立子目录返回 - * @param path - * @return - */ - private String getFolder(String path) { - SimpleDateFormat formater = new SimpleDateFormat("yyyyMMdd"); - path += "/" + formater.format(new Date()); - File dir = new File(this.getPhysicalPath(path)); - if (!dir.exists()) { - try { - dir.mkdirs(); - } catch (Exception e) { - this.state = this.errorInfo.get("DIR"); - return ""; - } - } - return path; - } - - /** - * 根据传入的虚拟路径获取物理路径 - * - * @param path - * @return - */ - private String getPhysicalPath(String path) { - String servletPath = this.request.getServletPath(); - String realPath = this.request.getSession().getServletContext() - .getRealPath(servletPath); - return new File(realPath).getParent() +"/" +path; - } - - public void setSavePath(String savePath) { - this.savePath = savePath; - } - - public void setAllowFiles(String[] allowFiles) { - this.allowFiles = allowFiles; - } - - public void setMaxSize(int size) { - this.maxSize = size; - } - - public long getSize() { - return this.size; - } - - public String getUrl() { - return this.url; - } - - public String getFileName() { - return this.fileName; - } - - public String getState() { - return this.state; - } - - public String getTitle() { - return this.title; - } - - public String getType() { - return this.type; - } - - public String getOriginalName() { - return this.originalName; - } -} - diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/UploaderMessage.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/UploaderMessage.java deleted file mode 100644 index 3eeb74d..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/UploaderMessage.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.util.ArrayList; - - -public class UploaderMessage { - private Status status; - private String statusMsg = ""; - private ArrayList errorKys; - private String error = ""; - private String filePath = ""; - - public Status getStatus() { - return status; - } - - public void setStatus(Status status) { - this.status = status; - } - - public String getStatusMsg() { - return statusMsg; - } - - public void setStatusMsg(String statusMsg) { - this.statusMsg = statusMsg; - } - - public ArrayList getErrorKys() { - return errorKys; - } - - public void setErrorKys(ArrayList errorKys) { - this.errorKys = errorKys; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - -} - - - - diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/XMLConfiguration.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/XMLConfiguration.java deleted file mode 100644 index b7aab39..0000000 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/utils/XMLConfiguration.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.tamguo.modules.sys.utils; - -import java.io.IOException; -import java.io.InputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; - -public class XMLConfiguration { - private Document document = null; - - public boolean readConfigFile(String configFilename) { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder db = dbf.newDocumentBuilder(); - document = db.parse(configFilename); - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - if (document == null) { - return false; - } - return true; - } - - public boolean readConfigFile(InputStream stream) { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder db = dbf.newDocumentBuilder(); - document = db.parse(stream); - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - if (document == null) { - return false; - } - return true; - } - - public Document getDocument() { - return document; - } - - protected void setDocument(Document document) { - this.document = document; - } -} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java index 75ce1e0..1118e5c 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java @@ -1,7 +1,6 @@ package com.tamguo.modules.sys.web; import java.util.List; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; @@ -11,13 +10,13 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSONArray; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysAreaEntity; import com.tamguo.modules.sys.model.SysCompanyEntity; import com.tamguo.modules.sys.model.condition.SysCompanyCondition; import com.tamguo.modules.sys.service.ISysAreaService; import com.tamguo.modules.sys.service.ISysCompanyService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/company") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CorpAdminController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CorpAdminController.java index 58b938c..96d5d2f 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CorpAdminController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CorpAdminController.java @@ -1,7 +1,6 @@ package com.tamguo.modules.sys.web; import java.util.Map; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -10,11 +9,11 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.baomidou.mybatisplus.plugins.Page; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysUserEntity; import com.tamguo.modules.sys.model.condition.SysUserCondition; import com.tamguo.modules.sys.service.ISysUserService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/corpAdmin") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/LoginController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/LoginController.java index 2fd81b9..697cda9 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/LoginController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/LoginController.java @@ -17,10 +17,10 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; +import com.tamguo.common.utils.Result; +import com.tamguo.common.utils.SystemConstant; import com.tamguo.modules.sys.service.ISysUserService; -import com.tamguo.modules.sys.utils.Result; import com.tamguo.modules.sys.utils.ShiroUtils; -import com.tamguo.modules.sys.utils.TamguoConstant; @Controller public class LoginController { @@ -41,7 +41,7 @@ public class LoginController { public Result toLogin(HttpServletRequest request, HttpServletResponse response , String username , Boolean rememberUser, String password, String validCode) throws IOException { try { - String kaptcha = ShiroUtils.getKaptcha(TamguoConstant.KAPTCHA_SESSION_KEY); + String kaptcha = ShiroUtils.getKaptcha(SystemConstant.KAPTCHA_SESSION_KEY); if (!validCode.equalsIgnoreCase(kaptcha)) { return Result.failResult("验证码错误"); } @@ -52,7 +52,7 @@ public class LoginController { subject.login(token); // 获取权限菜单 - request.getSession().setAttribute("userMenuList", iSysUserService.findUserMenuList()); + request.getSession().setAttribute("userMenuList", iSysUserService.findUserMenuList(ShiroUtils.getUserCode())); request.getSession().setAttribute("currAdmin", ShiroUtils.getUser()); } catch (UnknownAccountException e) { return Result.result(501, null, "找不到账户"); diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SecAdminController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SecAdminController.java index e266c69..59b009d 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SecAdminController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SecAdminController.java @@ -9,11 +9,11 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.baomidou.mybatisplus.plugins.Page; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysUserEntity; import com.tamguo.modules.sys.model.condition.SysUserCondition; import com.tamguo.modules.sys.model.enums.SysUserMgrTypeEnum; import com.tamguo.modules.sys.service.ISysUserService; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/secAdmin") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysAreaController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysAreaController.java index 10d5ba0..1e6b630 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysAreaController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysAreaController.java @@ -9,11 +9,11 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSONArray; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysAreaEntity; import com.tamguo.modules.sys.model.condition.SysAreaCondition; import com.tamguo.modules.sys.service.ISysAreaService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/area") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysMenuController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysMenuController.java index 4ab0afe..eed6614 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysMenuController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysMenuController.java @@ -9,11 +9,11 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSONArray; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysMenuEntity; import com.tamguo.modules.sys.model.condition.SysMenuCondition; import com.tamguo.modules.sys.service.ISysMenuService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/menu") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysOfficeController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysOfficeController.java index b67c0d5..56b74fb 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysOfficeController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysOfficeController.java @@ -1,6 +1,6 @@ package com.tamguo.modules.sys.web; -import java.util.List; +import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -10,11 +10,11 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSONArray; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysOfficeEntity; import com.tamguo.modules.sys.model.condition.SysOfficeCondition; import com.tamguo.modules.sys.service.ISysOfficeService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; /** * Controller - 组织 diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysPostController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysPostController.java index 162fa6d..ec3ab56 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysPostController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysPostController.java @@ -9,11 +9,11 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.baomidou.mybatisplus.plugins.Page; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysPostEntity; import com.tamguo.modules.sys.model.condition.SysPostCondition; import com.tamguo.modules.sys.service.ISysPostService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/post") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysRoleController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysRoleController.java index 4c7ecfd..fe76a35 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysRoleController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysRoleController.java @@ -11,12 +11,12 @@ import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.mapper.Condition; import com.baomidou.mybatisplus.plugins.Page; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysRoleEntity; import com.tamguo.modules.sys.model.condition.SysRoleCondition; import com.tamguo.modules.sys.service.ISysRoleDataScopeService; import com.tamguo.modules.sys.service.ISysRoleService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/role") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysUserController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysUserController.java index dc873e9..24e86bc 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysUserController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/SysUserController.java @@ -10,12 +10,12 @@ import org.springframework.web.servlet.ModelAndView; import com.baomidou.mybatisplus.mapper.Condition; import com.baomidou.mybatisplus.plugins.Page; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.Result; import com.tamguo.modules.sys.model.SysUserEntity; import com.tamguo.modules.sys.model.condition.SysUserCondition; import com.tamguo.modules.sys.service.ISysPostService; import com.tamguo.modules.sys.service.ISysUserService; -import com.tamguo.modules.sys.utils.ExceptionSupport; -import com.tamguo.modules.sys.utils.Result; @Controller @RequestMapping(path="sys/user") diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/ValidCodeController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/ValidCodeController.java index d12d487..9c8a36d 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/ValidCodeController.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/ValidCodeController.java @@ -9,10 +9,10 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import com.tamguo.common.utils.ExceptionSupport; +import com.tamguo.common.utils.SystemConstant; import com.tamguo.config.image.CaptchaUtils; -import com.tamguo.modules.sys.utils.ExceptionSupport; import com.tamguo.modules.sys.utils.ShiroUtils; -import com.tamguo.modules.sys.utils.TamguoConstant; @Controller public class ValidCodeController { @@ -23,14 +23,14 @@ public class ValidCodeController { response.setContentType("image/jpeg"); String a = CaptchaUtils.generateCaptcha(response.getOutputStream()); - ShiroUtils.setSessionAttribute(TamguoConstant.KAPTCHA_SESSION_KEY, a); + ShiroUtils.setSessionAttribute(SystemConstant.KAPTCHA_SESSION_KEY, a); } @RequestMapping("checkCode") @ResponseBody public Boolean checkCode(String validCode) throws ServletException, IOException { try { - String kaptcha = ShiroUtils.getKaptcha(TamguoConstant.KAPTCHA_SESSION_KEY); + String kaptcha = ShiroUtils.getKaptcha(SystemConstant.KAPTCHA_SESSION_KEY); if (validCode.equalsIgnoreCase(kaptcha)) { return true; }