Commit e4389f3c by 陶光胜

init

parents
# maven ignore
target/
*.jar
!.mvn/wrapper/*
*.war
*.zip
*.tar
*.tar.gz
.flattened-pom.xml
# eclipse ignore
.settings/
.project
.classpath
# idea ignore
.idea/
*.ipr
*.iml
*.iws
# temp ignore
*.log
*.cache
*.diff
*.patch
*.tmp
dubbo.cache*
# system ignore
.DS_Store
Thumbs.db
*.orig
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>haoban-manage-api</artifactId>
<version>${libraryVersion}</version>
<name>haoban-manage-api</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<haobanService>3.0-SNAPSHOT</haobanService>
<libraryVersion>3.0-SNAPSHOT</libraryVersion>
</properties>
<distributionManagement>
<repository>
<!-- 和 Maven setting 保持一致 -->
<id>nexus-snapshots</id>
<name>nexus distribution snapshot repository</name>
<!-- 这里使用 /content/repositories/snapshots/ -->
<url>http://182.254.134.223:8081/nexus/content/repositories/snapshots/</url>
<!--<url>http://stream.banli.mobi:8081/content/repositories/snapshots/</url>-->
</repository>
<snapshotRepository>
<!-- 和 Maven setting 保持一致 -->
<id>nexus-snapshots</id>
<name>nexus distribution snapshot repository</name>
<!-- 这里使用 /content/repositories/snapshots/ -->
<url>http://182.254.134.223:8081/nexus/content/repositories/Snapshots-1/</url>
<!--<url>http://stream.banli.mobi:8081/content/repositories/snapshots/</url>-->
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-base-api</artifactId>
<version>${haoban-base-api}</version>
</dependency>
</dependencies>
<build>
<finalName>haoban-manage-api</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<!--<version>1.1.0-SNAPSHOT</version>-->
<configuration>
<flattenMode>defaults</flattenMode>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package com.gic.haoban.manage.api.dto;
/**
* Created by tgs on 2020/2/9.
*/
public class TestDTO {
}
package com.gic.haoban.manage.api.enums;
/**
* 首页快捷设置用户配置类型
*
* @author zhurz
*/
public enum FirstUserConfigTypeEnum {
/**
* 首页快捷设置
*/
FIRST_QUICK_SETTING_VIEW(1),
/**
* 首页企业数据概览
*/
FIRST_DATA_VIEW(2);
/**
* 类型
*/
private Integer value;
FirstUserConfigTypeEnum(Integer value) {
this.value = value;
}
public Integer getValue() {
return value;
}
}
package com.gic.haoban.manage.api.service;
/**
* Created by tgs on 2020/2/9.
*/
public interface TestApiService {
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>haoban-manage-service</artifactId>
<version>${libraryVersion}</version>
<name>haoban-manage-service</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<haobanService>1.0-SNAPSHOT</haobanService>
<libraryVersion>3.0-SNAPSHOT</libraryVersion>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.2.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-common</artifactId>
<version>${haoban-common}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-config</artifactId>
<version>${haoban-config}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-manage-api</artifactId>
<version>${haoban-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-api</artifactId>
<version>${haoban-contacts-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-manage-api</artifactId>
<version>${haoban-contacts-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-auth-api</artifactId>
<version>${haoban-auth-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-message-api</artifactId>
<version>${haoban-message-api}</version>
</dependency>
</dependencies>
<build>
<finalName>haoban-manage-service</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classesDirectory>target/classes/</classesDirectory>
<archive>
<manifest>
<mainClass>com.alibaba.dubbo.container.Main</mainClass>
<!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.Test;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TestMapper {
/**
*/
int deleteByPrimaryKey(String id);
/**
*/
int insert(Test record);
/**
*/
int insertSelective(Test record);
/**
*/
Test selectByPrimaryKey(String id);
/**
*/
int updateByPrimaryKeySelective(Test record);
/**
*/
int updateByPrimaryKey(Test record);
/**
* 查询
*
* @return
*/
List<Test> queryList();
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
*
* @author fdh
*/
public class Test implements Serializable {
/**
*
*/
private String id;
/**
*
*/
private String name;
/**
*/
private static final long serialVersionUID = 1L;
/**
* This method returns the value of the database column test.id
*
* @return the value of test.id
*/
public String getId() {
return id;
}
/**
* This method sets the value of the database column test.id
*
* @param id the value for test.id
*/
public void setId(String id) {
this.id = id;
}
/**
* This method returns the value of the database column test.name
*
* @return the value of test.name
*/
public String getName() {
return name;
}
/**
* This method sets the value of the database column test.name
*
* @param name the value for test.name
*/
public void setName(String name) {
this.name = name;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.service;
/**
* Created by tgs on 2020/2/9.
*/
public interface TestService {
}
package com.gic.haoban.manage.service.service.impl;
/**
* Created by tgs on 2020/2/9.
*/
public class TestServiceImpl {
}
package com.gic.haoban.manage.service.service.out.impl;
/**
* Created by tgs on 2020/2/9.
*/
public class TestApiServiceImpl {
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:gic-haoban-init.xml" />
<import resource="classpath*:redis-init.xml"/>
<import resource="classpath:dubbo-haoban-manage-service.xml" />
<import resource="classpath:dubbo-setting-test.xml"/>
<import resource="classpath:jdbc-haoban-manage-service.xml" />
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.haoban.*" />
<!-- 应用名称 -->
<dubbo:application name="haoban-manage-service"/>
<dubbo:protocol name="dubbo" port="30007"/>
<dubbo:annotation package="com.gic.haoban.manage.service.service"/>
<bean class="com.gic.haoban.common.ext.LoggerLevelListen" id="loggerLevelListen">
<constructor-arg index="0" value="haoban-manage-service"/>
</bean>
</beans>
\ No newline at end of file
dubbo.registry.file=haoban-mobile-app-service
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:apollo="http://www.ctrip.com/schema/apollo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.ctrip.com/schema/apollo
http://www.ctrip.com/schema/apollo.xsd">
<!--<context:property-placeholder location="classpath:jdbc.properties" ignore-unresolvable="true"/>-->
<apollo:config namespaces="COMMON.dubbo, COMMON.jdbc"/>
<dubbo:monitor protocol="registry"/>
<dubbo:registry address="${zookeeper_host}" protocol="dubbo" id="remoteAddress" timeout="20000"
register="${shall_register:true}"
file="dubbo/remote/${dubbo.registry.file}/dubbo.cache"
default="true"/>
<dubbo:registry address="zookeeper://localhost:2181" protocol="dubbo" id="localAddress" timeout="10000"
file="dubbo/local/${dubbo.registry.file}/dubbo.cache" default="false"/>
<!--<dubbo:registry address="zookeeper://123.207.187.158:2199" protocol="dubbo" id="remoteAddress" timeout="20000" file="${catalina.home}/dubbo/${dubbo.registry.file}/dubbo.cache"/>-->
<dubbo:provider timeout="10000" retries="0" registry="${registry:remoteAddress}" threads="${jdbc.maxsize}"
queues="10000"
dispather="maintenance"/>
<dubbo:consumer timeout="10000" retries="0" check="false" registry="${registry:remoteAddress}"/>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:apollo="http://www.ctrip.com/schema/apollo"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.ctrip.com/schema/apollo
http://www.ctrip.com/schema/apollo.xsd">
<context:annotation-config />
<!--<context:component-scan base-package="com.gic.cloud" />-->
<!--<context:property-placeholder location="classpath*:jdbc-haoban.properties" ignore-unresolvable="true" />-->
<!--<bean id="propertyConfigurer"-->
<!--class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">-->
<!--<property name="ignoreUnresolvablePlaceholders" value="true"/>-->
<!--<property name="location" value="classpath:jdbc-haoban.properties" />-->
<!--</bean>-->
<!--<import resource="classpath*:applicationContext-db-only.xml"/>-->
<import resource="classpath*:applicationContext-db-only-with-emoji.xml"/>
<bean class="com.gic.haoban.common.init.HaobanSqlSessionFactoryBean" id="sqlSessionFactory">
<property name="dataSource" ref="dataSource" />
<property name="typeAliasesPackage" value="com.gic.haoban.**.entity,com.gic.haoban.*.entity" />
<property name="mapperLocations" value="classpath*:mapper/*.xml" />
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageHelper">
<property name="properties">
<value>
dialect=mysql
</value>
</property>
</bean>
</array>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.gic.haoban.**.dao.mapper,com.gic.haoban.*.mapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>
<bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 事务管理器 -->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:annotation-driven transaction-manager="txManager" />
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TestMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.Test">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
</resultMap>
<sql id="Base_Column_List">
id, name
</sql>
<select id="queryList" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from test
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>haoban-manage-web</artifactId>
<version>${libraryVersion}</version>
<packaging>war</packaging>
<name>haoban-manage-web Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<haobanService>1.0-SNAPSHOT</haobanService>
<commonVersion>3.0-SNAPSHOT</commonVersion>
<libraryVersion>3.0-SNAPSHOT</libraryVersion>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.2.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-dict-api</artifactId>
<version>${gic-dict-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>${gic-commons}</version>
<exclusions>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-config</artifactId>
<version>${gic-platform-config}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-api</artifactId>
<version>${haoban-contacts-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-manage-api</artifactId>
<version>${haoban-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-manage-api</artifactId>
<version>${haoban-contacts-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-common</artifactId>
<version>${haoban-common}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-auth-api</artifactId>
<version>${haoban-auth-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-operation-api</artifactId>
<version>${haoban-operation-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-config</artifactId>
<version>${haoban-config}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-api</artifactId>
<version>${gic-thirdparty-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-message-api</artifactId>
<version>${haoban-message-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-announcement-api</artifactId>
<version>${haoban-app-announcement-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-communicate-api</artifactId>
<version>${haoban-communicate-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-mobile-app-api</artifactId>
<version>${haoban-mobile-app-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-sdk</artifactId>
<version>${gic-thirdparty-sdk}</version>
</dependency>
<dependency>
<groupId>com.gic.operation</groupId>
<artifactId>gic-operation-api</artifactId>
<version>${gic-operation-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-api</artifactId>
<version>${gic-enterprise-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-clerk-api</artifactId>
<version>${gic-clerk-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-quartz-api</artifactId>
<version>${gic-quartz-api}</version>
</dependency>
</dependencies>
<build>
<finalName>haoban-manage-web</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.12.RC2</version>
<configuration>
<stopKey>gic-mall</stopKey>
<httpConnector>
<port>802</port>
</httpConnector>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.gic.haoban.manage.web.controller;
import com.gic.haoban.auth.api.dto.DisplayRelationShortInfoDTO;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.common.utils.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* Created 2018/7/18.
*
* @author hua
*/
public class WebBaseController {
protected final String defaultReturn = "json";
public HaobanResponse resultResponse(HaoBanErrCode errCode, Object data, String detailError) {
HaobanResponse response = new HaobanResponse();
response.setMessage(errCode.getMsg());
response.setErrorCode(errCode.getCode());
response.setResult(data);
response.setDetailError(detailError);
return response;
}
public HaobanResponse resultResponse(HaoBanErrCode errCode, Object data) {
return resultResponse(errCode, data, null);
}
public HaobanResponse resultResponse(HaoBanErrCode errCode) {
return resultResponse(errCode, null, null);
}
/**
* 获取登陆信息
*
* @return
*/
protected UserRightDetailDTO getLoginUser() {
return (UserRightDetailDTO) AuthRequestUtil.getSessionUser();
}
public boolean haveRight(List<DisplayRelationShortInfoDTO> list){
List<String> groupList = new ArrayList<String>();
List<String> storeList = new ArrayList<String>();
List<String> clerkList = new ArrayList<String>();
if(list==null){
return false;
}
for(DisplayRelationShortInfoDTO showDto :list){
if(showDto.getGroupId()!=null){
groupList.add(showDto.getGroupId());
}
if(showDto.getStoreId()!=null){
storeList.add(showDto.getStoreId());
}
if(showDto.getClerkId()!=null){
clerkList.add(showDto.getClerkId());
}
}
if(CollectionUtils.isEmpty(groupList) && CollectionUtils.isEmpty(storeList) && CollectionUtils.isEmpty(clerkList)){
return false;
}
return true;
}
}
package com.gic.haoban.manage.web.controller.test;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.CheckContainUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.TestDTO;
import com.gic.haoban.manage.api.service.TestService;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.TestQo;
import com.gic.haoban.manage.web.vo.TestVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* Created 2018/12/17.
*
* @author hua
*/
@Controller
@RequestMapping("/test")
public class TestController extends WebBaseController {
@Autowired
private TestService testService;
@RequestMapping("/testList")
@ResponseBody
public HaobanResponse testList(String id, BasePageInfo info) {
HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
Page<TestDTO> testDTOPage = testService.queryPage(info);
return resultResponse(errCode, testDTOPage);
}
@RequestMapping("/imcallback")
@ResponseBody
public JSONObject imcallback(@RequestBody JSONObject msg) {
System.out.println(msg);
System.out.println(msg.toJSONString());
String rest = "{\n" +
" \"ActionStatus\": \"OK\",\n" +
" \"ErrorInfo\": \"\",\n" +
" \"ErrorCode\": 0 // 0 为允许发言\n" +
"}";
return JSONObject.parseObject(rest);
}
@RequestMapping("/testListVo")
@ResponseBody
public HaobanResponse testListVo(TestQo qo, BasePageInfo info) {
HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
String s = CheckContainUtil.checkAttr(qo);
if (s != null) {
System.out.println("缺少参数");
errCode = HaoBanErrCode.ERR_5;
return resultResponse(errCode);
}
Page<TestDTO> testDTOPage = testService.queryPage(info);
List<TestVo> res = EntityUtil.changeEntityListByJSON(TestVo.class, testDTOPage.getResult());
return resultResponse(errCode, res);
}
}
package com.gic.haoban.manage.web.errCode;
/**
* Created by fudh on 2018/3/4.
*/
public enum HaoBanErrCode {
//update by 牧峰 2018-7-25 19:58:06
/**
* 操作失败
*/
ERR_0(0, "操作失败"),
/**
* 操作成功
*/
ERR_1(1, "操作成功"),
/**
* 缺少参数
*/
ERR_2(2, "缺少参数"),
/**
* 系统异常
*/
ERR_3(3, "系统异常"),
/**
* 登录异常
*/
ERR_4(4, "登录异常"),
/**
* 输入参数错误
*/
ERR_5(5, "输入参数错误"),
/**
* 该企业登录用户不存在
*/
ERR_6(6, "该企业登录用户不存在"),
/**
* 该用户缺少该权限
*/
ERR_7(7, "该用户缺少该权限"),
/**
* 查无数据
*/
ERR_8(8, "查无数据"),
/**
* 非法操作
*/
ERR_9(9, "非法操作"),
/**
* 用户已经登录
*/
ERR_10(10, "用户已经登录"),
/**
* 验证码发送失败
*/
ERR_11(11, "验证码发送失败"),
/**
* 验证码校验失败
*/
ERR_12(12, "验证码校验失败"),
/**
* 员工档案模块
*/
ERR_400001(400001, "通讯录中不存在"),
ERR_400002(400002, "企业不存在"),
ERR_400003(400003, "品牌不存在"),
ERR_400004(400004, "excel文件格式有问题"),
ERR_400005(400005, "选择文件错误"),
ERR_400006(400006, "模板内容为空"),
ERR_400007(400007, "总列数与模板不一致"),
ERR_400008(400008, "导入的title跟模板title描述不匹配"),
ERR_400009(400009, "共享企业或取得共享企业已达最大数量"),
ERR_400010(400010, "不是该企业无权限添加"),
ERR_400011(400011, "添加共享企业重复"),
ERR_400012(400012, "员工档案不存在"),
ERR_400013(400013, "没有查看共享通讯录的权限"),
ERR_400014(400014, "仅支持认证企业建立企业通讯录共享"),
ERR_400015(400015, "数据为空"),
ERR_400016(400016, "提交人不存在"),
/**
* 文件不存在
*/
ERR_20001(201, "文件不存在"),
/**
* 文件格式错误
*/
ERR_20002(202, "文件格式错误"),
/**
* 文件读取失败
*/
ERR_20003(203, "文件读取失败"),
/**
* 文件列数错误
*/
ERR_20004(204, "文件列数错误"),
//登录权限
ERR_30001(30001, "请添加权限"),
ERR_30002(30002, "二维码超时,请刷新二维码"),
ERR_30003(30003, "您没有管理员权限"),
ERR_30004(30004, "登录超时,请重新登录"),
ERR_30005(30005, "用户不存在"),
ERR_30006(30006, "用户名或密码错误"),
ERR_30007(30007, "未设置密码,请先设置密码"),
ERR_30008(30008, "超级管理员不存在"),
//角色
ERR_40001(40001, "角色异常"),
ERR_500002(500002, "角色下存在管理员,请移除管理员!"),
/**
* 办理离职
*/
ERR_100001(100001, "办理离职成功"),
ERR_100002(100002, "正在等待审核"),
ERR_100003(100003, "办理转正成功"),
ERR_100004(100004, "已经离职"),
ERR_100005(100005, "已经转正"),
ERR_100006(100006, "店长不能办理离职"),
ERR_100007(100007, "管理员不能办理离职"),
ERR_100008(100008, "与gic关联不能办理离职"),
/**
* 通讯录模块
*/
ERR_111111(111111, "用户已存在"),
ERR_111112(111112, "层级不能超过6"),
ERR_111113(111113, "店铺已存在"),
ERR_111114(111114, "该员工已在行政架构下"),
ERR_111115(1111115, "该员工已在门店架构下"),
ERR_111116(111116, "code不能为空"),
ERR_111117(111117, "code已存在"),
ERR_111118(111118, "部门不能为空"),
ERR_111119(111119, "门店不能为空"),
ERR_111120(111120, "手机不能为空"),
ERR_111121(111121, "姓名不能为空"),
ERR_111122(111122, "门店名称不能为空"),
ERR_111123(111123, "店长名称不能为空"),
ERR_111124(111124, "店长电话不能为空"),
ERR_111125(111125, "门店编号不能为空"),
ERR_111126(111126, "门店编号已存在"),
ERR_111127(111127, "该部门下存在部门不让删除"),
ERR_111128(111128, "该部门下存在店铺不让删除"),
ERR_111129(111129, "该部门下存在人员不让删除"),
ERR_111130(111130, "品牌不能修改"),
ERR_111131(111131, "店长不能删除"),
ERR_111132(111132, "管理员不能删除"),
ERR_111133(111133, "品牌名称不能重复"),
ERR_111134(111134, "未认证企业只能导入30家门店"),
ERR_111135(111135, "未认证企业只能导入200个用户"),
ERR_111136(111136, "部门名称不能重复"),
ERR_111137(111137, "其他管理员正在导入"),
ERR_111138(111138, "企业每次最多只能导入800个用户"),
ERR_111139(111134, "未认证企业只能导入200家门店"),
ERR_111140(111140,"已经与gic关联,无法操作"),
ERR_111141(111141,"门店面积不能超过999999"),
ERR_111142(111142,"品牌不能为空"),
ERR_111143(111143,"code或者手机号码已存在"),
ERR_111144(111144,"该企业或品牌已关联"),
// 企业设置
ERR_200001(200001, "员工不存在"),
ERR_200002(200002, "非当前登录企业员工"),
ERR_500001(500001, "该企业没关联好办"),
ERR_DEFINE(-888, "自定义错误"),
ERR_OTHER(-999, "未知错误code");
private int code;
private String msg;
private HaoBanErrCode(int code, String value) {
this.code = code;
this.msg = value;
}
public static HaoBanErrCode getValue(int code) {
for (HaoBanErrCode sec : HaoBanErrCode.values()) {
if (code == sec.getCode()) {
return sec;
}
}
ERR_OTHER.setMsg("未知错误code:" + code);
return ERR_OTHER;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
package com.gic.haoban.manage.web.exception;
/**
* Created 2018/7/24.
*
* @author hua
*/
public class ControllerException extends Exception {
}
package com.gic.haoban.manage.web.exception;
import com.gic.haoban.base.api.common.ShowFrontMessageException;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created 2018/7/24.
*
* @author hua
*/
@ControllerAdvice
public class GlobalExceptionHandler extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
private static final Pattern pattern = Pattern.compile("(.*: )(.*)(\\n.*)");
@ResponseBody
@ExceptionHandler(ShowFrontMessageException.class)
public HaobanResponse ControllerException(HttpServletResponse response, ShowFrontMessageException ex) {
HaobanResponse res = new HaobanResponse();
res.setErrorCode(HaoBanErrCode.ERR_0.getCode());
res.setMessage(ex.getMessage());
return res;
}
@ResponseBody
@ExceptionHandler(RuntimeException.class)
public HaobanResponse ControllerException(HttpServletResponse response, RuntimeException ex) {
HaobanResponse res = new HaobanResponse();
res.setErrorCode(HaoBanErrCode.ERR_3.getCode());
String message = ex.getMessage();
if (message != null && message.indexOf(ShowFrontMessageException.class.getName()) > -1) {
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
message = (matcher.group(2));
}
} else {
message = HaoBanErrCode.ERR_3.getMsg();
}
res.setMessage(message);
return res;
}
@ResponseBody
@ExceptionHandler(Exception.class)
public HaobanResponse ControllerException(HttpServletResponse response, Exception ex) {
logger.error("err");
ex.printStackTrace();
HaoBanErrCode errCode = HaoBanErrCode.ERR_3;
StringBuilder sb = new StringBuilder();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (PrintWriter printWriter = new PrintWriter(baos)) {
ex.printStackTrace(printWriter);
}
try {
sb.append(baos.toString());
} catch (Exception ignored) {
}
if (sb.length() == 0) {
sb.append(ex.getMessage());
}
// 输出详细错误信息,便于调试
return resultResponse(errCode, null, sb.toString());
}
@ResponseBody
@ExceptionHandler(NoLoginException.class)
public HaobanResponse ControllerException(HttpServletResponse response, NoLoginException ex) {
return resultResponse(HaoBanErrCode.ERR_4);
}
}
package com.gic.haoban.manage.web.exception;
/**
* 用户未登陆异常
*
* @author zhurz
*/
public class NoLoginException extends RuntimeException {
}
package com.gic.haoban.manage.web.init;
import com.gic.dict.api.dto.GlobalDictMap;
import com.gic.dict.api.service.ManagerDictService;
import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class MyApplicationContextAware implements ApplicationContextAware {
private Logger log = LogManager.getLogger(MyApplicationContextAware.class);
private static ApplicationContext applicationContext;
@Autowired
private ManagerDictService managerDictService;
@Autowired
private QuartzService quartzService;
@Override
public void setApplicationContext(ApplicationContext appContext) throws BeansException {
applicationContext = appContext;
GlobalDictMap.countyMap = managerDictService.getCountysMap();
GlobalDictMap.cityMap = managerDictService.getCitysMap();
GlobalDictMap.provinceMap = managerDictService.getProvincesMap();
GlobalDictMap.dictMap = managerDictService.getDictList();
GlobalDictMap.storeCategoryDictMap = managerDictService.getStoreCategoryDictList();
log.info("数据字典放入缓存");
QuartzTaskDTO taskDTO =buildQuartzTaskDTO("haoban-dismiss-enterprise-time");
taskDTO.setTaskParam("");
taskDTO.setTaskStatus(1);
taskDTO.setTaskTimeInfo("0 30 0 * * *");
// taskDTO.setTaskTimeInfo("0 0/1 * * * *");
quartzService.addOrUpdateQuartzTask(taskDTO);
QuartzTaskDTO task =buildSendReportQuartzTaskDTO("haoban-send-report");
task.setTaskParam("");
task.setTaskStatus(1);
task.setTaskTimeInfo("0 0 12 1 * 0");
quartzService.addOrUpdateQuartzTask(taskDTO);
QuartzTaskDTO memberExportTask =buildMemberExportQuartzTaskDTO("haoban-member-export");
memberExportTask.setTaskParam("-1");
memberExportTask.setTaskStatus(1);
memberExportTask.setTaskTimeInfo("0 0/15 * * * *");
quartzService.addOrUpdateQuartzTask(memberExportTask);
}
private QuartzTaskDTO buildMemberExportQuartzTaskDTO(String id) {
QuartzTaskDTO taskDTO = new QuartzTaskDTO();
taskDTO.setReferId(id);
taskDTO.setTaskMethod("quartzMemberExport");
taskDTO.setTaskService("com.gic.haoban.app.member.service.api.service.MemberExportApiService");
return taskDTO;
}
private QuartzTaskDTO buildQuartzTaskDTO(String id){
QuartzTaskDTO taskDTO = new QuartzTaskDTO();
taskDTO.setReferId(id);
taskDTO.setTaskMethod("taskDismissEnterprise");
taskDTO.setTaskService("com.gic.haoban.manage.api.service.EnterpriseService");
return taskDTO;
}
private QuartzTaskDTO buildSendReportQuartzTaskDTO(String id){
QuartzTaskDTO taskDTO = new QuartzTaskDTO();
taskDTO.setReferId(id);
taskDTO.setTaskMethod("sendReportMessage");
taskDTO.setTaskService("com.gic.haoban.data.api.service.SendReportMessageApiService");
return taskDTO;
}
}
package com.gic.haoban.manage.web.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.common.utils.HaobanResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
import java.lang.reflect.Method;
/**
* Created 2019/2/20.
*
* @author hua
*/
@ControllerAdvice
public class ResponseInterceptor implements ResponseBodyAdvice<HaobanResponse> {
private Logger logger = LoggerFactory.getLogger(ResponseInterceptor.class);
@Override
public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> aClass) {
Method method = methodParameter.getMethod();
String name = method.getName();
logger.info("method:{}", name);
return true;
}
@Override
public HaobanResponse beforeBodyWrite(HaobanResponse haobanResponse, MethodParameter methodParameter, MediaType mediaType, Class<? extends HttpMessageConverter<?>> aClass, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
String response = JSONObject.toJSONString(haobanResponse);
logger.info("response:{}", response);
return haobanResponse;
}
}
package com.gic.haoban.manage.web.interceptor;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.common.utils.AuthRequestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 测试登录拦截器
*
* @author zhurz
*/
public class TestLoginInterceptor extends HandlerInterceptorAdapter {
private static Logger logger = LoggerFactory.getLogger(TestLoginInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
// 测试用
HttpServletRequest request = AuthRequestUtil.getRequest();
String testFlag = request.getHeader("testFlag");
if (!"Y".equals(testFlag)) return true;
String testEnterpriseId = request.getHeader("testEnterpriseId");
String testUserId = request.getHeader("testUserId");
UserRightDetailDTO sessionUser = new UserRightDetailDTO();
sessionUser.setUserId(testUserId);
sessionUser.setEnterpriseId(testEnterpriseId);
AuthRequestUtil.setSessionUser(sessionUser);
return true;
}
}
package com.gic.haoban.manage.web.interceptor;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.auth.api.anno.MenuCheck;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.auth.api.enums.RoleCodeEnum;
import com.gic.haoban.auth.api.service.ClerkRightManageService;
import com.gic.haoban.common.utils.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Map;
/**
* Created 2018/7/20.
*
* @author hua
*/
public class WebInterceptor extends HandlerInterceptorAdapter {
private static Logger logger= LoggerFactory.getLogger(WebInterceptor.class);
@Autowired
private ClerkRightManageService clerkRightManageService;
private void errorResult(HttpServletResponse httpServletResponse, HaoBanErrCode errCode) {
HaobanResponse response = new HaobanResponse();
response.setErrorCode(errCode.getCode());
response.setMessage(errCode.getMsg());
PrintWriter writer = null;
try {
httpServletResponse.setHeader("Content-type", "application/json;charset=UTF-8");
writer = httpServletResponse.getWriter();
writer.append(JSONObject.toJSONString(response));
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
String requestURI = httpServletRequest.getRequestURI();
logger.info("post-url:{}", requestURI);
Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
logger.info("post-params:{}", JSONObject.toJSONString(parameterMap));
UserRightDetailDTO loginUser = (UserRightDetailDTO) AuthRequestUtil.getSessionUser();
if (loginUser == null) {
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4);
logger.info("用户不存在!");
return false;
}
HandlerMethod method = null;
if (o instanceof HandlerMethod) {
method = (HandlerMethod) (o);
}
if (method == null) {
return true;
}
MenuCheck methodAnnotation = method.getMethodAnnotation(MenuCheck.class);
if (StringUtils.isNotBlank(loginUser.getEnterpriseId())) {
httpServletRequest.setAttribute("enterpriseId", loginUser.getEnterpriseId());
}
if (StringUtils.isNotBlank(loginUser.getUserId())) {
httpServletRequest.setAttribute("clerkId", loginUser.getUserId());
}
if (null != methodAnnotation) {
String value = methodAnnotation.value();
RoleCodeEnum[] roleCodes = methodAnnotation.roleCodes();
boolean b = true;
//权限判断
if (StringUtils.isNotBlank(value)) {
b = loginUser.checkRight(value);
}
//角色判读
if (b) {
if (roleCodes.length > 0) {
b = Arrays.stream(roleCodes).anyMatch(codeEnum -> loginUser.checkRole(codeEnum.getCode()));
}
}
if (!b) {
logger.info("缺少权限");
errorResult(httpServletResponse, HaoBanErrCode.ERR_7);
}
return b;
}
return true;
}
@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
logger.info("end");
}
@Override
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
logger.info("end");
}
}
package com.gic.haoban.manage.web.qo;
import com.gic.haoban.base.api.common.AppJSONField;
import java.io.Serializable;
/**
* Created 2018/10/22.
*
* @author hua
*/
public class TestQo implements Serializable {
private String id;
@AppJSONField(format = "ignore")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
package com.gic.haoban.manage.web.response;
import com.gic.haoban.auth.api.dto.MenuRightDTO;
import java.io.Serializable;
import java.util.List;
/**
* Created 2018/12/27.
*
* @author hua
*/
public class MenuDetailResponse implements Serializable {
private MenuRightDTO top;
private List<MenuRightDTO> leftMenu;
private MenuRightDTO current;
public MenuRightDTO getTop() {
return top;
}
public void setTop(MenuRightDTO top) {
this.top = top;
}
public List<MenuRightDTO> getLeftMenu() {
return leftMenu;
}
public void setLeftMenu(List<MenuRightDTO> leftMenu) {
this.leftMenu = leftMenu;
}
public MenuRightDTO getCurrent() {
return current;
}
public void setCurrent(MenuRightDTO current) {
this.current = current;
}
}
package com.gic.haoban.manage.web.response;
import com.gic.haoban.auth.api.dto.MenuRightInfoDTO;
import com.gic.haoban.auth.api.dto.RoleDTO;
import java.io.Serializable;
import java.util.List;
/**
* Created 2018/12/17.
*
* @author hua
*/
public class RoleDetailResponse implements Serializable {
public RoleDTO role;
public List<MenuRightInfoDTO> menuRightList;
public RoleDTO getRole() {
return role;
}
public void setRole(RoleDTO role) {
this.role = role;
}
public List<MenuRightInfoDTO> getMenuRightList() {
return menuRightList;
}
public void setMenuRightList(List<MenuRightInfoDTO> menuRightList) {
this.menuRightList = menuRightList;
}
}
\ No newline at end of file
package com.gic.haoban.manage.web.response;
import com.gic.haoban.manage.api.dto.EnterpriseDTO;
import java.io.Serializable;
import java.util.List;
/**
* Created 2018/12/28.
*
* @author hua
*/
public class WebLoginResponse implements Serializable {
private String userId;
private List<EnterpriseDTO> enterpriseList;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public List<EnterpriseDTO> getEnterpriseList() {
return enterpriseList;
}
public void setEnterpriseList(List<EnterpriseDTO> enterpriseList) {
this.enterpriseList = enterpriseList;
}
}
package com.gic.haoban.manage.web.utils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
public class IOUtils {
/**
* 6.编写一个程序,将D:\\java目录下的所有.java文件复制到D:\\jad目录下,
* 并将原来文件的扩展名从.java改为.jad。
*/
// public static class FileCopy {
// public static void main(String[] args) {
//
// File oriFile = new File("D:\\java");//原文件目录
// //file.exists():判断文件目录是否存在
// //file.isDirectory():判断文件目录是否是一个目录
// if(!(oriFile.exists() && oriFile.isDirectory())){
// System.out.println("文件目录不存在!");
// }
//
// File[] files = oriFile.listFiles(
// new FilenameFilter(){ //文件名称过滤器
// public boolean accept(File file, String name) {
// return name.endsWith(".java");
// }
// }
// );
// System.out.println(files.length);//原文件个数
//
// File objFile = new File("D:\\jad");//目标文件目录
// //objFile.exists():判断目标文件目录是否存在
// //objFile.mkdir():创建目标文件目录
// if(!objFile.exists()){
// objFile.mkdir();
// }
//
// //copyByte(files,objFile);
// copyChar(files,objFile);
// System.out.println("写入完成!");
//
// }
//使用字节流进行文件复制(字节缓冲流可以不使用,使用其目的主要是为了提高性能)
private static void copyByte(File[] files,File objFile){
InputStream inputStream = null;
OutputStream outputStream = null;
BufferedInputStream bufferedInputStream = null;
BufferedOutputStream bufferedOutputStream = null;
for(File f : files){
//替换文件后缀
String objFileName = f.getName().replaceAll("\\.ACC$", ".mp3");
try {
inputStream = new FileInputStream(f);
outputStream = new FileOutputStream(new File(objFile,objFileName));
bufferedInputStream = new BufferedInputStream(inputStream);
bufferedOutputStream = new BufferedOutputStream(outputStream);
int c = 0;
while((c = bufferedInputStream.read()) != -1){
bufferedOutputStream.write(c);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bufferedOutputStream.close();
bufferedInputStream.close();
outputStream.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//使用字符流进行文件复制(字符缓冲流可以不使用,使用其目的主要是为了提高性能)
public static void copyChar(File file,File objFile){
Reader reader = null;
Writer writer = null;
BufferedReader bufferedReader = null;
BufferedWriter bufferedWriter = null;
//替换文件后缀
String objFileName = file.getName().replaceAll("\\.AAC$", ".mp3");
try {
reader = new FileReader(file);
writer = new FileWriter(new File(objFile,objFileName));
bufferedReader = new BufferedReader(reader);
bufferedWriter = new BufferedWriter(writer);
int c = 0;
while ((c=bufferedReader.read()) != -1) {
bufferedWriter.write(c);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
bufferedWriter.close();
bufferedReader.close();
writer.close();
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
package com.gic.haoban.manage.web.utils;
import org.apache.commons.lang3.StringUtils;
/**
* @author yao
* NationCodePhoneFormater
*/
public class NationCodePhoneFormater {
/**
* 大陆手机号码
*/
public static final String CHINA = "86";
public static String format(String nationCode, String phone) {
if (CHINA.equals(nationCode)) {
return phone;
}
if (StringUtils.isBlank(phone)){
return "";
}
return StringUtils.isBlank(nationCode)? phone: ("+" + nationCode + "-" + phone);
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
/**
* Created 2018/10/22.
*
* @author hua
*/
public class TestVo implements Serializable {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
dubbo.registry.file=haoban-manage-web
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath*:gic-haoban-init.xml" />
<import resource="dubbo-haoban-manage-web.xml"/>
<import resource="classpath*:dubbo-setting.xml"/>
<import resource="classpath*:redis-init.xml"/>
<import resource="redis-session.xml"/>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.haoban" />
<!-- 应用名称 -->
<dubbo:application name="haoban-apps-web"/>
<dubbo:protocol name="dubbo" port="30009"/>
<!-- 使用zookeeper注册中心暴露服务地址 -->
<!-- <dubbo:registry address="zookeeper://192.168.1.118:2181" protocol="dubbo" id="localAdd"/> -->
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.1.xsd">
<util:constant static-field="org.springframework.session.data.redis.config.ConfigureRedisAction.NO_OP"/>
<bean id="redisHttpSessionConfiguration"
class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration">
<property name="maxInactiveIntervalInSeconds" value="1800"/>
<property name="cookieSerializer" ref="defaultCookieSerializer"/>
</bean>
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="100"/>
<property name="maxIdle" value="10"/>
</bean>
<bean id="jedisConnectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" destroy-method="destroy">
<property name="hostName" value="${redis.host}"/>
<property name="port" value="${redis.port}"/>
<property name="password" value="${redis.password}"/>
<property name="timeout" value="3000"/>
<property name="usePool" value="true"/>
<property name="poolConfig" ref="jedisPoolConfig"/>
<property name="database" value="${redis.database}"/>
</bean>
<bean id="defaultCookieSerializer" class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="customSessionId"/>
<property name="cookiePath" value="/"></property>
</bean>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:interceptors>
<bean class="com.gic.haoban.common.interceptor.CORSInterceptor"/>
<bean class="com.gic.commons.interceptor.HeaderTagInterceptor"/>
<bean class="com.gic.haoban.common.ext.PropertyViewClearInterceptor"/>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/login.json"/>
<mvc:exclude-mapping path="/login-*"/>
<mvc:exclude-mapping path="/gic-login*"/>
<mvc:exclude-mapping path="/*test.json"/>
<mvc:exclude-mapping path="/test/*"/>
<mvc:exclude-mapping path="/login"/>
<mvc:exclude-mapping path="/nationcode/get-nationcode-list"/>
<mvc:exclude-mapping path="/get-pic-code"/>
<mvc:exclude-mapping path="/phone-login"/>
<mvc:exclude-mapping path="/upload-file*"/>
<mvc:exclude-mapping path="/upload-file-voice"/>
<bean class="com.gic.haoban.manage.web.interceptor.WebInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
</beans>
\ No newline at end of file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 扫描注解包路径,多个包用逗号分隔,不填pacakge表示扫描当前ApplicationContext中所有的类 -->
<context:component-scan base-package="com.gic.haoban.*" />
<!-- 启动对@AspectJ注解的支持 -->
<aop:aspectj-autoproxy />
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="UTF-8"></property>
<property name="maxUploadSize" value="-1"></property>
</bean>
<bean class="com.gic.redis.data.aop.RedisCacheAop" id="redisCacheAop"/>
<!-- 明确js/css/jpg/gif等静态资源的访问不通过Constroller -->
<mvc:default-servlet-handler />
<!-- 启动注解驱动的Spring MVC功能,注册请求url和注解POJO类方法的映射 -->
<mvc:annotation-driven>
<!-- 设置不使用默认的消息转换器 -->
<mvc:message-converters register-defaults="false">
<bean class="com.gic.haoban.common.ext.MappingJackson2HttpMessagePropertyViewConverter"/>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/x-www-form-urlencoded;charset=UTF-8</value>
<!--默认是 iso-8859-1 -->
</list>
</property>
</bean>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 (解决中文乱码) -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/x-www-form-urlencoded;charset=UTF-8</value>
<!--默认是 iso-8859-1 -->
</list>
</property>
</bean>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
</list>
</property>
</bean>
<!---->
<!--<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">-->
<!--<property name="converters">-->
<!--<set>-->
<!--<bean class="com.gic.commons.util.DateConverter"></bean>-->
<!--</set>-->
<!--</property>-->
<!--</bean>-->
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<!-- 扩展名至mimeType的映射,即 /user.json => application/json -->
<property name= "favorPathExtension" value= "true" />
<!-- 用于开启 /userinfo/123?format=json 的支持 -->
<property name= "favorParameter" value= "true" />
<property name= "parameterName" value= "format"/>
<!-- 是否忽略Accept Header -->
<property name= "ignoreAcceptHeader" value= "false"/>
<property name="mediaTypes">
<value>
html=text/html
json=application/json
</value>
</property>
<property name="defaultContentType" value="text/html"/>
</bean>
<!-- 视图解析器配置 -->
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
<!-- If no extension matched, use JSP view -->
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="order" value="0"/>
<property name="contentNegotiationManager" ref="contentNegotiationManager"/>
<property name="defaultViews">
<list>
<bean class="com.gic.haoban.common.ext.MappingJackson2JsonPropertyView" />
</list>
</property>
</bean>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-conf.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-*.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>springSessionRepositoryFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSessionRepositoryFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gic</groupId>
<artifactId>haoban-manage</artifactId>
<packaging>pom</packaging>
<version>3.0-SNAPSHOT</version>
<modules>
<module>haoban-manage-api</module>
<module>haoban-manage-service</module>
<module>haoban-manage-web</module>
</modules>
<distributionManagement>
<repository>
<!-- 和 Maven setting 保持一致 -->
<id>nexus-snapshots</id>
<name>nexus distribution snapshot repository</name>
<!-- 这里使用 /content/repositories/snapshots/ -->
<url>http://182.254.134.223:8081/nexus/content/repositories/snapshots/</url>
<!--<url>http://stream.banli.mobi:8081/content/repositories/snapshots/</url>-->
</repository>
<snapshotRepository>
<!-- 和 Maven setting 保持一致 -->
<id>nexus-snapshots</id>
<name>nexus distribution snapshot repository</name>
<!-- 这里使用 /content/repositories/snapshots/ -->
<url>http://182.254.134.223:8081/nexus/content/repositories/Snapshots-1/</url>
<!--<url>http://stream.banli.mobi:8081/content/repositories/snapshots/</url>-->
</snapshotRepository>
</distributionManagement>
<dependencies>
</dependencies>
</project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment