main
parent
412b301085
commit
c2454e2071
@ -0,0 +1,29 @@ |
||||
.idea |
||||
log |
||||
parent.iml |
||||
|
||||
service/target/* |
||||
|
||||
bweb/target/* |
||||
bweb/log/* |
||||
bweb/bweb.iml |
||||
|
||||
cweb/target/* |
||||
cweb/log/* |
||||
cweb/cweb.iml |
||||
|
||||
order/target/* |
||||
order/log/* |
||||
order/order.iml |
||||
|
||||
user/target/* |
||||
user/log/* |
||||
user/cweb.iml |
||||
|
||||
openapi/target/* |
||||
openapi/log/* |
||||
openapi/cweb.iml |
||||
|
||||
schedule/target/* |
||||
schedule/log/* |
||||
schedule/demo-schedule.iml |
@ -0,0 +1,45 @@ |
||||
<?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.cg</groupId> |
||||
<artifactId>cg-parent</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<groupId>com.cg</groupId> |
||||
<artifactId>bweb</artifactId> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.cg</groupId> |
||||
<artifactId>service</artifactId> |
||||
<version>PACKT-SNAPSHOT</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<resources> |
||||
<resource> |
||||
<directory>src/main/resources/${env}</directory> |
||||
<filtering>false</filtering> |
||||
</resource> |
||||
</resources> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-surefire-plugin</artifactId> |
||||
<configuration> |
||||
<skip>true</skip> |
||||
</configuration> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
@ -0,0 +1,30 @@ |
||||
package com; |
||||
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; |
||||
import com.alicp.jetcache.anno.config.EnableMethodCache; |
||||
import com.cg.common.utils.SpringContextUtil; |
||||
import org.mybatis.spring.annotation.MapperScan; |
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.boot.web.servlet.ServletComponentScan; |
||||
import org.springframework.context.ApplicationContext; |
||||
import org.springframework.scheduling.annotation.EnableScheduling; |
||||
import org.springframework.transaction.annotation.EnableTransactionManagement; |
||||
|
||||
@SpringBootApplication |
||||
// @ComponentScan
|
||||
@EnableTransactionManagement |
||||
@EnableScheduling |
||||
@EnableMethodCache(basePackages = "com.cg") |
||||
@EnableCreateCacheAnnotation |
||||
@ServletComponentScan |
||||
@MapperScan("com.cg.dao") |
||||
public class BWebApplication |
||||
{ |
||||
public static void main( String[] args ) |
||||
{ |
||||
ApplicationContext app = SpringApplication.run(BWebApplication.class, args); |
||||
SpringContextUtil.setApplicationContext(app); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,127 @@ |
||||
package com.cweb.config; |
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
import com.fasterxml.jackson.databind.module.SimpleModule; |
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||
import com.cg.common.security.UserCenter; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.http.converter.HttpMessageConverter; |
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.List; |
||||
|
||||
@Configuration |
||||
public class AuthConfig implements WebMvcConfigurer { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(AuthConfig.class); |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
/** |
||||
* 获取配置文件debug变量 |
||||
*/ |
||||
@Value("${debug}") |
||||
private boolean debug = false; |
||||
|
||||
/** |
||||
* 解决18位long类型数据转json失去精度问题 |
||||
* @param converters |
||||
*/ |
||||
@Override |
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters){ |
||||
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); |
||||
|
||||
ObjectMapper objectMapper = jsonConverter.getObjectMapper(); |
||||
SimpleModule simpleModule = new SimpleModule(); |
||||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); |
||||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); |
||||
objectMapper.registerModule(simpleModule); |
||||
|
||||
converters.add(jsonConverter); |
||||
} |
||||
|
||||
public void addInterceptors(InterceptorRegistry registry) { |
||||
registry.addInterceptor(new HandlerInterceptorAdapter() { |
||||
|
||||
@Override |
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, |
||||
Object handler) throws Exception { |
||||
if(debug){ |
||||
return true; |
||||
} |
||||
String token = request.getHeader("Authorization"); |
||||
|
||||
if(StringUtils.isNotBlank(token) && userCenter.isLogin(token)){//如果未登录,将无法使用任何接口
|
||||
return true; |
||||
} else if(request instanceof StandardMultipartHttpServletRequest) { |
||||
StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request; |
||||
if(userCenter.isLogin(re.getRequest())){ |
||||
return true; |
||||
} else { |
||||
log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL()); |
||||
response.setStatus(401); |
||||
return false; |
||||
} |
||||
} else{ |
||||
log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL()); |
||||
response.setStatus(401); |
||||
return false; |
||||
} |
||||
} |
||||
}) |
||||
.addPathPatterns("/**") |
||||
.excludePathPatterns("/swagger-resources/**") |
||||
.excludePathPatterns("/**/api-docs") |
||||
.excludePathPatterns("/**/springfox-swagger-ui/**") |
||||
.excludePathPatterns("/**/swagger-ui.html") |
||||
.excludePathPatterns("/fileUpload/*") |
||||
.excludePathPatterns("/common/*") |
||||
.excludePathPatterns("/secMenu/queryMenuList") |
||||
; |
||||
} |
||||
|
||||
public 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 = ips[index]; |
||||
if (!("unknown".equalsIgnoreCase(strIp))) { |
||||
ip = strIp; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
return ip; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,24 @@ |
||||
package com.bweb.config; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
import javax.servlet.ServletContextEvent; |
||||
import javax.servlet.ServletContextListener; |
||||
import javax.servlet.annotation.WebListener; |
||||
|
||||
@WebListener |
||||
public class ConfigListener implements ServletContextListener { |
||||
|
||||
@Autowired |
||||
private SysConfig sysConfig; |
||||
|
||||
@Override |
||||
public void contextInitialized(ServletContextEvent sce) { |
||||
SysConst.setSysConfig(sysConfig); |
||||
} |
||||
|
||||
@Override |
||||
public void contextDestroyed(ServletContextEvent sce) { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.bweb.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.cors.CorsConfiguration; |
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||
import org.springframework.web.filter.CorsFilter; |
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @ClassName CorsConfig |
||||
* @Description: TODO () |
||||
* @Author 胡锐 |
||||
* @Date 2020/12/16 |
||||
**/ |
||||
@Configuration |
||||
public class CorsConfig extends WebMvcConfigurerAdapter { |
||||
@Override |
||||
public void addCorsMappings(CorsRegistry registry) { |
||||
registry.addMapping("/**") |
||||
.allowedOrigins("*") |
||||
.allowCredentials(true) |
||||
.allowedMethods("GET", "POST", "DELETE", "PUT") |
||||
.maxAge(3600); |
||||
} |
||||
private CorsConfiguration buildConfig() { |
||||
CorsConfiguration corsConfiguration = new CorsConfiguration(); |
||||
List<String> list = new ArrayList<>(); |
||||
list.add("*"); |
||||
corsConfiguration.setAllowedOrigins(list); |
||||
/* |
||||
// 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等)
|
||||
*/ |
||||
corsConfiguration.addAllowedOrigin("*"); |
||||
corsConfiguration.addAllowedHeader("*"); |
||||
corsConfiguration.addAllowedMethod("*"); |
||||
return corsConfiguration; |
||||
} |
||||
@Bean |
||||
public CorsFilter corsFilter() { |
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
||||
source.registerCorsConfiguration("/**", buildConfig()); |
||||
return new CorsFilter(source); |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.bweb.config; |
||||
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import javax.servlet.MultipartConfigElement; |
||||
|
||||
@Configuration |
||||
public class MultipartConfig { |
||||
|
||||
/** |
||||
* 文件上传配置 |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public MultipartConfigElement multipartConfigElement() { |
||||
MultipartConfigFactory factory = new MultipartConfigFactory(); |
||||
//文件最大
|
||||
factory.setMaxFileSize("300MB"); //KB,MB
|
||||
//设置总上传数据总大小
|
||||
factory.setMaxRequestSize("350MB"); |
||||
return factory.createMultipartConfig(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,109 @@ |
||||
package com.bweb.config; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect; |
||||
import com.fasterxml.jackson.annotation.PropertyAccessor; |
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
import org.springframework.cache.annotation.CachingConfigurerSupport; |
||||
import org.springframework.cache.annotation.EnableCaching; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.data.redis.connection.RedisConnectionFactory; |
||||
import org.springframework.data.redis.core.*; |
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
||||
import org.springframework.data.redis.serializer.StringRedisSerializer; |
||||
|
||||
|
||||
@Configuration |
||||
@EnableCaching //开启注解
|
||||
public class RedisConfig extends CachingConfigurerSupport { |
||||
|
||||
/** |
||||
* retemplate相关配置 |
||||
* @param factory |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { |
||||
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>(); |
||||
// 配置连接工厂
|
||||
template.setConnectionFactory(factory); |
||||
|
||||
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
|
||||
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class); |
||||
|
||||
ObjectMapper om = new ObjectMapper(); |
||||
// 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
||||
// 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
|
||||
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); |
||||
jacksonSeial.setObjectMapper(om); |
||||
|
||||
// 值采用json序列化
|
||||
template.setValueSerializer(jacksonSeial); |
||||
//使用StringRedisSerializer来序列化和反序列化redis的key值
|
||||
template.setKeySerializer(new StringRedisSerializer()); |
||||
|
||||
// 设置hash key 和value序列化模式
|
||||
template.setHashKeySerializer(new StringRedisSerializer()); |
||||
template.setHashValueSerializer(jacksonSeial); |
||||
template.afterPropertiesSet(); |
||||
|
||||
return template; |
||||
} |
||||
|
||||
/** |
||||
* 对hash类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForHash(); |
||||
} |
||||
|
||||
/** |
||||
* 对redis字符串类型数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForValue(); |
||||
} |
||||
|
||||
/** |
||||
* 对链表类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForList(); |
||||
} |
||||
|
||||
/** |
||||
* 对无序集合类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForSet(); |
||||
} |
||||
|
||||
/** |
||||
* 对有序集合类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForZSet(); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
package com.bweb.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import springfox.documentation.builders.ApiInfoBuilder; |
||||
import springfox.documentation.builders.RequestHandlerSelectors; |
||||
import springfox.documentation.service.ApiInfo; |
||||
import springfox.documentation.service.Contact; |
||||
import springfox.documentation.spi.DocumentationType; |
||||
import springfox.documentation.spring.web.plugins.Docket; |
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
||||
|
||||
/** |
||||
* SwaggerConfig.java |
||||
* 项目名称: |
||||
* 包: |
||||
* 类名称: SwaggerConfig.java |
||||
* 类描述: 构建restful api接口文档 |
||||
* 创建人: |
||||
* 创建时间: 2017 下午4:23:45 |
||||
*/ |
||||
@Configuration |
||||
@EnableSwagger2 |
||||
public class SwaggerConfig |
||||
{ |
||||
|
||||
/** |
||||
* 描述api的基本信息 |
||||
* 基本信息会展现在文档页面中 |
||||
* @return [api的基本信息] |
||||
*/ |
||||
ApiInfo apiInfo() |
||||
{ |
||||
return new ApiInfoBuilder().title("hgj-BWeb").description("提供给管理平台的接口").termsOfServiceUrl("").version("1.0.0") |
||||
.contact(new Contact("", "", "")).build(); |
||||
} |
||||
|
||||
@Bean |
||||
public Docket customImplementation() |
||||
{ |
||||
return new Docket(DocumentationType.SWAGGER_2).select() |
||||
.apis(RequestHandlerSelectors.basePackage("com")) |
||||
.build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class) |
||||
.directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.bweb.config; |
||||
|
||||
import lombok.Data; |
||||
import lombok.Getter; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.context.annotation.PropertySource; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component("sysConfig") |
||||
@ConfigurationProperties |
||||
@PropertySource("classpath:/config.properties") |
||||
@Data |
||||
public class SysConfig { |
||||
|
||||
private String fileUrl; |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.bweb.config; |
||||
|
||||
public class SysConst { |
||||
|
||||
private static SysConfig sysConfig; |
||||
|
||||
public static void setSysConfig(SysConfig arg){ |
||||
sysConfig = arg; |
||||
} |
||||
|
||||
public static SysConfig getSysConfig(){ |
||||
if (null == sysConfig) { |
||||
//防止空指针异常
|
||||
sysConfig = new SysConfig(); |
||||
return sysConfig; |
||||
} |
||||
return sysConfig; |
||||
} |
||||
} |
@ -0,0 +1,117 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.cg.common.exception.ErrorCode; |
||||
import com.cg.common.exception.ErrorHelp; |
||||
import com.cg.common.exception.SysCode; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.entity.BsUser; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.user.BsUserService; |
||||
import com.cg.service.user.impl.BsUserServiceImpl; |
||||
import com.cg.sysenum.SecUserStatusEnum; |
||||
import com.cg.sysenum.UserStatusEnum; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: BsUserController |
||||
* @author: HuRui |
||||
* @date: 2024/5/6 |
||||
**/ |
||||
@Controller |
||||
@RequestMapping(value="/user") |
||||
@Api(value="用户管理") |
||||
public class BsUserController { |
||||
private static Logger log = LoggerFactory.getLogger(BsUserController.class); |
||||
@Resource |
||||
private BsUserService userService; |
||||
|
||||
|
||||
@RequestMapping(value="/restore",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "恢复") |
||||
public ResponseData restore(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("userId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
// 查询用户详情
|
||||
BsUser user = userService.getUser(body.getLong("userId")); |
||||
if (user == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
user.setStatus(UserStatusEnum.status1.getCode()); |
||||
userService.editData(user); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/disable",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "禁用") |
||||
public ResponseData disable(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("userId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
// 查询用户详情
|
||||
BsUser user = userService.getUser(body.getLong("userId")); |
||||
if (user == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
user.setStatus(SecUserStatusEnum.status2.getCode()); |
||||
userService.editData(user); |
||||
|
||||
// 退出当前登录信息
|
||||
userService.loginOut(new BsUserServiceImpl().token(user)); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryUserList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询用户列表") |
||||
public ResponseData queryUserList(@RequestParam(value = "name" , required = false) String name, |
||||
@RequestParam(value = "phone" , required = false) String phone, |
||||
@RequestParam(value = "status" , required = false) Integer status, |
||||
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||
try { |
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("name", name); |
||||
param.put("phone", phone); |
||||
param.put("status", status); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(userService.getList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.SecDictionaryService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/common") |
||||
@Api(value="共用接口") |
||||
public class CommonController { |
||||
Logger log = LoggerFactory.getLogger(CommonController.class); |
||||
@Resource |
||||
private SecDictionaryService secDictionaryService; |
||||
|
||||
@RequestMapping(value="/queryDictionary",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询数据字典") |
||||
public ResponseData queryDictionary(@RequestParam(value = "codeType" , required = false) String codeType, |
||||
@RequestParam(value = "codeValue" , required = false) String codeValue) { |
||||
try { |
||||
|
||||
if (StringUtils.isBlank(codeType) && StringUtils.isBlank(codeValue)) { |
||||
return ResponseMsgUtil.success(secDictionaryService.getDictionary()); |
||||
|
||||
} else if (StringUtils.isNotBlank(codeType) && StringUtils.isNotBlank(codeValue)) { |
||||
return ResponseMsgUtil.success(secDictionaryService.getDictionary(codeType, codeValue)); |
||||
|
||||
} else if (StringUtils.isNotBlank(codeType)) { |
||||
return ResponseMsgUtil.success(secDictionaryService.getDictionary(codeType)); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success(null); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,98 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.cg.common.utils.DateUtil; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.bweb.config.SysConfig; |
||||
import com.cg.model.ResponseData; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import net.coobird.thumbnailator.Thumbnails; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.File; |
||||
import java.io.FileInputStream; |
||||
import java.io.FileOutputStream; |
||||
import java.io.InputStream; |
||||
import java.util.*; |
||||
|
||||
@RestController |
||||
@RequestMapping(value="/fileUpload") |
||||
@Api(value="文件上传") |
||||
public class FileUploadController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(FileUploadController.class); |
||||
|
||||
@Resource |
||||
private SysConfig sysConfig; |
||||
|
||||
@RequestMapping(value = "/fileUpload", method = RequestMethod.POST) |
||||
@ApiOperation(value = "上传文件(超过500KB压缩)") |
||||
@ResponseBody |
||||
public ResponseData fileUpload(@RequestParam(value = "files" , required = false) MultipartFile files, |
||||
HttpServletRequest request, |
||||
HttpServletResponse response |
||||
) { |
||||
try { |
||||
response.setHeader("Access-Control-Allow-Origin", "*"); |
||||
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver( |
||||
request.getSession().getServletContext()); |
||||
// 判断 request 是否有文件上传,即多部分请求
|
||||
List<String> fileNames = new ArrayList<String>(); |
||||
if (multipartResolver.isMultipart(request)) { |
||||
// 转换成多部分request
|
||||
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; |
||||
Iterator<String> iterator = multiRequest.getFileNames(); |
||||
|
||||
while (iterator.hasNext()) { |
||||
MultipartFile file = multiRequest.getFile(iterator.next()); |
||||
if (file != null) { |
||||
FileOutputStream out = null; |
||||
try { |
||||
String fileType = file.getOriginalFilename() |
||||
.substring(file.getOriginalFilename().lastIndexOf(".") + 1); |
||||
String fileName = System.currentTimeMillis() + "." + fileType; |
||||
String childPath = DateUtil.date2String(new Date(), "yyyyMM"); |
||||
String destDirName = sysConfig.getFileUrl() + File.separator + childPath; |
||||
File dir = new File(destDirName); |
||||
if (!dir.exists()) { |
||||
dir.mkdirs(); |
||||
} |
||||
|
||||
out = new FileOutputStream(destDirName + File.separator + fileName); |
||||
out.write(file.getBytes()); |
||||
out.flush(); |
||||
fileNames.add(childPath + "/" + fileName); |
||||
// 图片压缩
|
||||
InputStream fis = new FileInputStream(destDirName + File.separator + fileName); |
||||
if (fis.available() > 300000) { |
||||
Thumbnails.of(new FileInputStream(destDirName + File.separator + fileName)).scale(0.5).toFile(new File(destDirName + File.separator + fileName)); |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
} finally { |
||||
if (out != null) { |
||||
out.close(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
return ResponseMsgUtil.success(fileNames); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,301 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.cg.common.exception.ErrorCode; |
||||
import com.cg.common.exception.ErrorHelp; |
||||
import com.cg.common.exception.SysCode; |
||||
import com.cg.common.utils.HttpUtils; |
||||
import com.cg.common.utils.HttpsUtils; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.entity.SecMenu; |
||||
import com.cg.entity.SecRoleMenuRel; |
||||
import com.cg.model.MenuTreeModel; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.SecMenuService; |
||||
import com.cg.service.SecRoleMenuRelService; |
||||
import com.cg.sysenum.SecMenuTypeEnum; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.*; |
||||
import java.util.function.Function; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @className: SecMenu |
||||
* @author: HuRui |
||||
* @date: 2024/3/28 |
||||
**/ |
||||
@Controller |
||||
@RequestMapping(value="/secMenu") |
||||
@Api(value="系统菜单管理") |
||||
public class SecMenuController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(SecUserController.class); |
||||
|
||||
@Resource |
||||
private SecMenuService secMenuService; |
||||
@Resource |
||||
private SecRoleMenuRelService secRoleMenuRelService; |
||||
|
||||
@RequestMapping(value="/editMenu",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑菜单") |
||||
public ResponseData editMenu(@RequestBody SecMenu body) { |
||||
try { |
||||
if (body == null |
||||
|| body.getMenuType() == null |
||||
|| StringUtils.isBlank(body.getMenuName()) |
||||
|| StringUtils.isBlank(body.getMenuUrl()) |
||||
|| body.getMenuSort() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
SecMenu secMenu; |
||||
|
||||
if (body.getId() != null) { |
||||
// 查询菜单
|
||||
secMenu = secMenuService.queryDetail(body.getId()); |
||||
if (secMenu == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
} else { |
||||
secMenu = new SecMenu(); |
||||
} |
||||
if (secMenu.getMenuPSid() != null) { |
||||
// 查询父类菜单
|
||||
SecMenu parentMenu = secMenuService.queryDetail(secMenu.getMenuPSid()); |
||||
if (parentMenu == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
} |
||||
|
||||
secMenu.setMenuType(body.getMenuType()); |
||||
secMenu.setMenuName(body.getMenuName()); |
||||
secMenu.setMenuUrl(body.getMenuUrl()); |
||||
secMenu.setMenuUrlImg(body.getMenuUrlImg()); |
||||
secMenu.setMenuPSid(body.getMenuPSid()); |
||||
secMenu.setMenuSort(body.getMenuSort()); |
||||
secMenu.setMenuDesc(body.getMenuDesc()); |
||||
if (secMenu.getId() == null) { |
||||
secMenuService.create(secMenu); |
||||
} else { |
||||
secMenuService.update(secMenu); |
||||
} |
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryDetail",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询详情") |
||||
public ResponseData queryDetail(@RequestParam(value = "menuId" , required = true) Long menuId) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(secMenuService.queryDetail(menuId)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/delMenu",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除菜单") |
||||
public ResponseData delMenu(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("menuId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
secMenuService.delete(body.getLong("menuId")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/assignMenu",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "分配菜单") |
||||
public ResponseData assignMenu(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null |
||||
|| body.getLong("roleId") == null |
||||
|| body.getJSONArray("menuIds").isEmpty()) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
List<Long> list = body.getJSONArray("menuIds") |
||||
.stream().map(o -> Long.parseLong(o.toString())) |
||||
.collect(Collectors.toList()); |
||||
|
||||
secMenuService.assignMenu(body.getLong("roleId"),list ); |
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryMenuList",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询菜单列表") |
||||
public ResponseData queryMenuList() { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(secMenuService.getAllList()); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryRoleMenuArray",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询分配菜单树") |
||||
public ResponseData queryRoleMenuArray(@RequestParam(value = "roleId" , required = true) Long roleId) { |
||||
try { |
||||
|
||||
// 查询角色菜单权限
|
||||
Map<Long, SecMenu> roleMenu = secMenuService.queryRoleMenu(roleId, SecMenuTypeEnum.type1).stream() |
||||
.collect(Collectors.toMap(SecMenu::getId, Function.identity())); |
||||
|
||||
// 系统菜单叶节点
|
||||
List<String> menuLeafList = new ArrayList<>(); |
||||
|
||||
// 角色菜单叶节点
|
||||
List<String> roleLeafList = new ArrayList<>(); |
||||
|
||||
// 获取全部菜单
|
||||
List<SecMenu> menuList = secMenuService.getAllList(); |
||||
|
||||
// 获取最顶层菜单
|
||||
List<SecMenu> topLevelMenuList = menuList.stream() |
||||
.filter(o -> o.getMenuPSid() == null) |
||||
.sorted(Comparator.comparing(SecMenu::getMenuSort)) |
||||
.collect(Collectors.toList()); |
||||
// 递归获取系统菜单叶子节点
|
||||
for (SecMenu topLevelMenu : topLevelMenuList) { |
||||
if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { |
||||
recursionMenu(menuList, topLevelMenu.getId(), menuLeafList); |
||||
} |
||||
} |
||||
|
||||
// 筛选角色菜单叶节点
|
||||
for (String leaf : menuLeafList) { |
||||
SecMenu menu = roleMenu.get(Long.parseLong(leaf)); |
||||
if (menu != null) { |
||||
roleLeafList.add(""+menu.getId()); |
||||
} |
||||
} |
||||
|
||||
return ResponseMsgUtil.success(roleLeafList); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryRoleMenuTree",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询角色菜单树") |
||||
public ResponseData queryRoleMenuTree(@RequestParam(value = "roleId" , required = false) Long roleId) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(secMenuService.queryMenuTree(roleId)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryMenuTree",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询角色菜单树") |
||||
public ResponseData queryMenuTree() { |
||||
try { |
||||
List<Map<String,Object>> mapList = new ArrayList<>(); |
||||
Map<String,Object> map; |
||||
|
||||
// 获取全部菜单
|
||||
List<SecMenu> menuList = secMenuService.getAllList(); |
||||
|
||||
// 获取最顶层菜单
|
||||
List<SecMenu> topLevelMenuList = menuList.stream() |
||||
.filter(o -> o.getMenuPSid() == null) |
||||
.sorted(Comparator.comparing(SecMenu::getMenuSort)) |
||||
.collect(Collectors.toList()); |
||||
|
||||
for (SecMenu topLevelMenu : topLevelMenuList) { |
||||
if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { |
||||
map = new LinkedHashMap<>(); |
||||
map.put("key", ""+topLevelMenu.getId()); |
||||
map.put("title", topLevelMenu.getMenuName()); |
||||
// 获取下级菜单
|
||||
map.put("children", recursionMenu(menuList, topLevelMenu.getId(), new ArrayList<>())); |
||||
mapList.add(map); |
||||
} |
||||
} |
||||
|
||||
return ResponseMsgUtil.success(mapList); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 递归获取菜单 |
||||
* @param dataSource 数据源 |
||||
* @param parentMenuId 父级菜单id |
||||
* @return |
||||
*/ |
||||
public List<Map<String,Object>> recursionMenu(List<SecMenu> dataSource, Long parentMenuId, List<String> leaf) { |
||||
List<Map<String,Object>> mapList = new ArrayList<>(); |
||||
Map<String,Object> map; |
||||
|
||||
List<SecMenu> collect = dataSource.stream() |
||||
.filter(o -> o.getMenuPSid() != null && o.getMenuPSid().equals(parentMenuId)) |
||||
.sorted(Comparator.comparing(SecMenu::getMenuSort)) |
||||
.collect(Collectors.toList()); |
||||
for (SecMenu menu : collect) { |
||||
if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { |
||||
map = new LinkedHashMap<>(); |
||||
map.put("key", ""+menu.getId()); |
||||
map.put("title", menu.getMenuName()); |
||||
// 获取下级菜单
|
||||
List<Map<String, Object>> recursioned = recursionMenu(dataSource, menu.getId(), leaf); |
||||
if (recursioned.isEmpty()) { |
||||
leaf.add(""+menu.getId()); |
||||
map.put("isLeaf", true); |
||||
} else { |
||||
map.put("children", recursioned); |
||||
} |
||||
mapList.add(map); |
||||
} |
||||
} |
||||
return mapList; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,144 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.cg.common.exception.ErrorCode; |
||||
import com.cg.common.exception.ErrorHelp; |
||||
import com.cg.common.exception.SysCode; |
||||
import com.cg.common.utils.MD5Util; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.entity.SecRole; |
||||
import com.cg.entity.SecUser; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.SecRoleService; |
||||
import com.cg.service.SecUserService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringEscapeUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: SecRoleController |
||||
* @author: HuRui |
||||
* @date: 2024/3/27 |
||||
**/ |
||||
@Controller |
||||
@RequestMapping(value="/secRole") |
||||
@Api(value="系统用户角色管理") |
||||
public class SecRoleController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(SecUserController.class); |
||||
|
||||
@Resource |
||||
private SecRoleService secRoleService; |
||||
|
||||
@RequestMapping(value="/editRole",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑角色") |
||||
public ResponseData editRole(@RequestBody SecRole body) { |
||||
try { |
||||
if (body == null || StringUtils.isBlank(body.getRoleName())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
SecRole secRole; |
||||
if (body.getId() != null) { |
||||
// 查询角色
|
||||
secRole = secRoleService.getDetail(body.getId()); |
||||
if (secRole == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
} else { |
||||
secRole = new SecRole(); |
||||
secRole.setStatus(1); |
||||
} |
||||
secRole.setRoleName(body.getRoleName()); |
||||
secRole.setRoleDesc(body.getRoleDesc()); |
||||
secRoleService.editData(secRole); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/delRole",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除角色") |
||||
public ResponseData delRole(@RequestBody SecRole body) { |
||||
try { |
||||
if (body == null || body.getId() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
secRoleService.delete(body.getId()); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryDetail",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询详情") |
||||
public ResponseData queryDetail(@RequestParam(value = "roleId" , required = true) Long roleId) { |
||||
try { |
||||
|
||||
secRoleService.delete(roleId); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData queryList(@RequestParam(value = "roleName" , required = false) String roleName, |
||||
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||
try { |
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("roleName", roleName); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(secRoleService.getList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryAllRole",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询全部角色") |
||||
public ResponseData queryAllRole() { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(secRoleService.getList(new HashMap<>())); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,310 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.cg.common.security.UserCenter; |
||||
import com.cg.model.SecUserSessionObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.cg.common.exception.ErrorCode; |
||||
import com.cg.common.exception.ErrorHelp; |
||||
import com.cg.common.exception.SysCode; |
||||
import com.cg.common.utils.MD5Util; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.entity.SecUser; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.SecUserLoginLogService; |
||||
import com.cg.service.SecUserService; |
||||
import com.cg.sysenum.SecUserObjectTypeEnum; |
||||
import com.cg.sysenum.SecUserStatusEnum; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.models.auth.In; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/secUser") |
||||
@Api(value="系统用户管理") |
||||
public class SecUserController { |
||||
Logger log = LoggerFactory.getLogger(SecUserController.class); |
||||
|
||||
@Resource |
||||
private SecUserService secUserService; |
||||
@Resource |
||||
private SecUserLoginLogService secUserLoginLogService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value="/editUser",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑用户") |
||||
public ResponseData editUser(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null |
||||
|| StringUtils.isBlank(body.getString("userName")) |
||||
|| StringUtils.isBlank(body.getString("loginName")) |
||||
|| body.getLong("roleId") == null |
||||
) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
SecUser secUser; |
||||
if (body.getLong("id") != null) { |
||||
// 查询账户
|
||||
secUser = secUserService.getDetail(body.getLong("id")); |
||||
// 校验重复登录账户
|
||||
SecUser user = secUserService.getDetailByLoginName(body.getString("loginName")); |
||||
if (user != null && !user.getId().equals(body.getLong("id"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "登录账户已存在"); |
||||
} |
||||
} else { |
||||
secUser = new SecUser(); |
||||
secUser.setPassword(MD5Util.encode("123456".getBytes())); |
||||
secUser.setObjectType(SecUserObjectTypeEnum.type1.getCode()); |
||||
secUser.setStatus(SecUserStatusEnum.status1.getCode()); |
||||
|
||||
// 校验重复登录账户
|
||||
if (secUserService.getDetailByLoginName(body.getString("loginName")) != null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "登录账户已存在"); |
||||
} |
||||
} |
||||
|
||||
secUser.setUserName(body.getString("userName")); |
||||
secUser.setLoginName(body.getString("loginName")); |
||||
secUser.setTelephone(body.getString("telephone")); |
||||
secUser.setRoleId(body.getLong("roleId")); |
||||
secUserService.editUser(secUser); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/delete",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除用户") |
||||
public ResponseData delete(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("userId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
// 查询用户详情
|
||||
SecUser secUser = secUserService.getDetail(body.getLong("userId")); |
||||
if (secUser == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
secUser.setStatus(SecUserStatusEnum.status0.getCode()); |
||||
secUserService.editUser(secUser); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/restore",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "恢复") |
||||
public ResponseData restore(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("userId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
// 查询用户详情
|
||||
SecUser secUser = secUserService.getDetail(body.getLong("userId")); |
||||
if (secUser == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
secUser.setStatus(SecUserStatusEnum.status1.getCode()); |
||||
secUserService.editUser(secUser); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/resetPwd",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "账户密码重置") |
||||
public ResponseData resetPwd(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("userId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
secUserService.resetPwd(body.getLong("userId")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
@RequestMapping(value="/disable",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "禁用") |
||||
public ResponseData disable(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("userId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
// 查询用户详情
|
||||
SecUser secUser = secUserService.getDetail(body.getLong("userId")); |
||||
if (secUser == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
secUser.setStatus(SecUserStatusEnum.status2.getCode()); |
||||
secUserService.editUser(secUser); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryDetail",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询详情") |
||||
public ResponseData queryDetail(@RequestParam(value = "userId" , required = true) Long userId) { |
||||
try { |
||||
// 查询详情
|
||||
SecUser secUser = secUserService.getDetail(userId); |
||||
if (secUser != null) { |
||||
secUser.setPassword(null); |
||||
} |
||||
return ResponseMsgUtil.success(secUser); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData queryList(@RequestParam(value = "userName", required = false) String userName, |
||||
@RequestParam(value = "loginName", required = false) String loginName, |
||||
@RequestParam(value = "telephone", required = false) String telephone, |
||||
@RequestParam(value = "objectType", required = false) Integer objectType, |
||||
@RequestParam(value = "status", required = false) Integer status, |
||||
@RequestParam(value = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize", required = true) Integer pageSize) { |
||||
try { |
||||
|
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("userName", userName); |
||||
param.put("loginName", loginName); |
||||
param.put("telephone", telephone); |
||||
param.put("objectType", objectType); |
||||
param.put("status", status); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(secUserService.getList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
@RequestMapping(value="/queryLoginLogList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询登录日志列表") |
||||
public ResponseData queryLoginLogList(@RequestParam(value = "userId", required = true) String userId, |
||||
@RequestParam(value = "status", required = false) Integer status, |
||||
@RequestParam(value = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize", required = true) Integer pageSize) { |
||||
try { |
||||
|
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("userId", userId); |
||||
param.put("status", status); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(secUserLoginLogService.getLogList(param)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/login",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "登录") |
||||
public ResponseData login(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null |
||||
|| StringUtils.isBlank(body.getString("loginName")) |
||||
|| StringUtils.isBlank(body.getString("password")) |
||||
) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success(secUserService.login(body.getString("loginName"), body.getString("password"))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryUser",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询账户") |
||||
public ResponseData queryUser() { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(userCenter.getSessionModel(SecUserSessionObject.class)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/loginOut",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "退出登录") |
||||
public ResponseData loginOut(HttpServletRequest request) { |
||||
try { |
||||
try { |
||||
SecUserSessionObject session = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (session != null) { |
||||
userCenter.remove(request); |
||||
} |
||||
} catch (Exception e) {} |
||||
return ResponseMsgUtil.success("退出成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,156 @@ |
||||
package com.bweb.controller.cms; |
||||
|
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.cg.common.exception.ErrorCode; |
||||
import com.cg.common.exception.ErrorHelp; |
||||
import com.cg.common.exception.SysCode; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.entity.CmsContent; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.cms.CmsContentService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/cms") |
||||
@Api(value="cms") |
||||
public class CmsContentController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(CmsContentController.class); |
||||
|
||||
@Resource |
||||
private CmsContentService cmsContentService; |
||||
|
||||
@RequestMapping(value="/editCms",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑CMS") |
||||
public ResponseData editCms(@RequestBody CmsContent body, HttpServletRequest request) { |
||||
try { |
||||
|
||||
if (body == null |
||||
|| body.getPlatformCode() == null |
||||
|| StringUtils.isBlank(body.getName()) |
||||
|| StringUtils.isBlank(body.getCode())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
CmsContent cmsContent; |
||||
|
||||
if (body.getId() != null) { |
||||
// 查询CMS
|
||||
cmsContent = cmsContentService.queryDetail(body.getId()); |
||||
if (cmsContent == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.CONTENT_NOT_FOUND, ""); |
||||
} |
||||
} else { |
||||
cmsContent = new CmsContent(); |
||||
cmsContent.setCreateTime(new Date()); |
||||
} |
||||
|
||||
cmsContent.setUpdateTime(new Date()); |
||||
cmsContent.setStatus(1); |
||||
cmsContent.setName(body.getName()); |
||||
cmsContent.setAppid(body.getAppid()); |
||||
cmsContent.setJumpType(body.getJumpType()); |
||||
cmsContent.setJumpUrl(body.getJumpUrl()); |
||||
cmsContent.setPlatformCode(body.getPlatformCode()); |
||||
cmsContent.setImg(body.getImg()); |
||||
cmsContent.setCode(body.getCode()); |
||||
|
||||
if (body.getId() != null) { |
||||
cmsContentService.update(cmsContent); |
||||
} else { |
||||
cmsContentService.create(cmsContent); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
|
||||
} |
||||
|
||||
@RequestMapping(value="/getCms",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData getCms(@RequestParam(value = "code" , required = false) String code, |
||||
@RequestParam(value = "name" , required = false) String name, |
||||
@RequestParam(value = "status" , required = false) Integer status, |
||||
@RequestParam(value = "platformCode" , required = false) String platformCode, |
||||
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||
try { |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("code", code); |
||||
map.put("platformCode", platformCode); |
||||
map.put("name", name); |
||||
map.put("status", status); |
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(cmsContentService.getList(map))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/delete",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除") |
||||
public ResponseData delete(@RequestParam(value = "id" , required = false) Long id) { |
||||
try { |
||||
|
||||
cmsContentService.delete(id , false); |
||||
|
||||
return ResponseMsgUtil.success("删除成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
@RequestMapping(value="/cmsUpDown",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "商品上下架") |
||||
public ResponseData cmsUpDown(@RequestParam(value = "id" , required = false) Long id, HttpServletRequest request) { |
||||
try { |
||||
|
||||
CmsContent cmsContent = cmsContentService.queryDetail(id); |
||||
|
||||
if (cmsContent.getStatus() == 1) { |
||||
cmsContent.setStatus(2); |
||||
cmsContent.setUpdateTime(new Date()); |
||||
} else if (cmsContent.getStatus() == 2) { |
||||
cmsContent.setStatus(1); |
||||
cmsContent.setUpdateTime(new Date()); |
||||
|
||||
} |
||||
|
||||
cmsContentService.update(cmsContent); |
||||
|
||||
return ResponseMsgUtil.success("成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,89 @@ |
||||
server: |
||||
port: 9702 |
||||
servlet: |
||||
context-path: /brest |
||||
|
||||
#配置是否为debug模式,debug模式下,不开启权限校验 |
||||
debug: false |
||||
|
||||
#datasource数据源设置 |
||||
spring: |
||||
datasource: |
||||
url: jdbc:mysql://139.9.154.68:3306/cg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false |
||||
username: root |
||||
password: HF123456. |
||||
type: com.alibaba.druid.pool.DruidDataSource |
||||
driver-class-name: com.mysql.jdbc.Driver |
||||
filters: stat |
||||
maxActive: 10 |
||||
initialSize: 5 |
||||
maxWait: 60000 |
||||
minIdle: 5 |
||||
timeBetweenEvictionRunsMillis: 60000 |
||||
minEvictableIdleTimeMillis: 300000 |
||||
validationQuery: select 'x' |
||||
testWhileIdle: true |
||||
testOnBorrow: false |
||||
testOnReturn: false |
||||
poolPreparedStatements: true |
||||
maxOpenPreparedStatements: 20 |
||||
redis: |
||||
database: 1 |
||||
host: 139.9.154.68 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
timeout: 1000 |
||||
jedis: |
||||
pool: |
||||
max-active: 20 |
||||
max-wait: -1 |
||||
max-idle: 10 |
||||
min-idle: 0 |
||||
#配置日期返回至前台为时间戳 |
||||
jackson: |
||||
serialization: |
||||
write-dates-as-timestamps: true |
||||
mybatis: |
||||
mapperLocations: |
||||
- classpath*:sqlmap*/*.xml |
||||
type-aliases-package: |
||||
org.springboot.sample.entity |
||||
|
||||
pagehelper: |
||||
helperDialect: mysql |
||||
reasonable: true |
||||
supportMethodsArguments: true |
||||
params: count=countSql |
||||
|
||||
rocketmq: |
||||
name-server: 139.9.154.68:9876 |
||||
producer: |
||||
access-key: huifukeji |
||||
secret-key: HF123456. |
||||
#必须指定group |
||||
group: default-group |
||||
consumer: |
||||
access-key: huifukeji |
||||
secret-key: HF123456. |
||||
|
||||
jetcache: |
||||
statIntervalMinutes: 15 |
||||
areaInCacheName: false |
||||
local: |
||||
default: |
||||
type: linkedhashmap |
||||
keyConvertor: fastjson |
||||
remote: |
||||
default: |
||||
type: redis |
||||
host: 139.9.154.68 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
keyConvertor: fastjson |
||||
broadcastChannel: projectA |
||||
valueEncoder: java |
||||
valueDecoder: java |
||||
poolConfig: |
||||
minIdle: 5 |
||||
maxIdle: 20 |
||||
maxTotal: 50 |
@ -0,0 +1 @@ |
||||
fileUrl=/home/project/phg/filesystem |
@ -0,0 +1,72 @@ |
||||
<configuration> |
||||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<pattern>%d %p (%file:%line\)- %m%n</pattern> |
||||
<charset>UTF-8</charset> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="baselog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/base.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/base.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="daolog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/dao.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="errorlog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/error.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/error.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<root level="DEBUG"> |
||||
<appender-ref ref="STDOUT" /> |
||||
</root> |
||||
<logger name="com.cg" level="DEBUG"> |
||||
<appender-ref ref="baselog" /> |
||||
</logger> |
||||
<logger name="com.cg.dao" level="DEBUG"> |
||||
<appender-ref ref="daolog" /> |
||||
</logger> |
||||
<logger name="com.cg" level="ERROR"> |
||||
<appender-ref ref="errorlog" /> |
||||
</logger> |
||||
</configuration> |
@ -0,0 +1,56 @@ |
||||
server: |
||||
port: 9301 |
||||
servlet: |
||||
context-path: /crest |
||||
|
||||
#配置是否为debug模式,debug模式下,不开启权限校验 |
||||
debug: false |
||||
|
||||
#datasource数据源设置 |
||||
spring: |
||||
datasource: |
||||
url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false |
||||
username: root |
||||
password: HF123456. |
||||
type: com.alibaba.druid.pool.DruidDataSource |
||||
driver-class-name: com.mysql.jdbc.Driver |
||||
filters: stat |
||||
maxActive: 10 |
||||
initialSize: 5 |
||||
maxWait: 60000 |
||||
minIdle: 5 |
||||
timeBetweenEvictionRunsMillis: 60000 |
||||
minEvictableIdleTimeMillis: 300000 |
||||
validationQuery: select 'x' |
||||
testWhileIdle: true |
||||
testOnBorrow: false |
||||
testOnReturn: false |
||||
poolPreparedStatements: true |
||||
maxOpenPreparedStatements: 20 |
||||
redis: |
||||
database: 1 |
||||
host: 139.9.154.68 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
timeout: 1000 |
||||
jedis: |
||||
pool: |
||||
max-active: 20 |
||||
max-wait: -1 |
||||
max-idle: 10 |
||||
min-idle: 0 |
||||
#配置日期返回至前台为时间戳 |
||||
jackson: |
||||
serialization: |
||||
write-dates-as-timestamps: true |
||||
mybatis: |
||||
mapperLocations: |
||||
- classpath*:sqlmap*/*.xml |
||||
type-aliases-package: |
||||
org.springboot.sample.entity |
||||
|
||||
pagehelper: |
||||
helperDialect: mysql |
||||
reasonable: true |
||||
supportMethodsArguments: true |
||||
params: count=countSql |
@ -0,0 +1,2 @@ |
||||
fileUrl=/home/project/hsg/filesystem |
||||
cmsPath=/home/project/hsg/filesystem/cmsPath |
@ -0,0 +1,72 @@ |
||||
<configuration> |
||||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<pattern>%d %p (%file:%line\)- %m%n</pattern> |
||||
<charset>UTF-8</charset> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="baselog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/base.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/base.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="daolog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/dao.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="errorlog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/error.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/error.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<root level="DEBUG"> |
||||
<appender-ref ref="STDOUT" /> |
||||
</root> |
||||
<logger name="com.cg" level="DEBUG"> |
||||
<appender-ref ref="baselog" /> |
||||
</logger> |
||||
<logger name="com.cg.dao" level="DEBUG"> |
||||
<appender-ref ref="daolog" /> |
||||
</logger> |
||||
<logger name="com.cg" level="ERROR"> |
||||
<appender-ref ref="errorlog" /> |
||||
</logger> |
||||
</configuration> |
@ -0,0 +1,86 @@ |
||||
server: |
||||
port: 9702 |
||||
servlet: |
||||
context-path: /brest |
||||
|
||||
#配置是否为debug模式,debug模式下,不开启权限校验 |
||||
debug: false |
||||
|
||||
#datasource数据源设置 |
||||
spring: |
||||
datasource: |
||||
url: jdbc:mysql://192.168.0.63:21100/phg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 |
||||
username: phg |
||||
password: HUfukeji123456!@# |
||||
type: com.alibaba.druid.pool.DruidDataSource |
||||
driver-class-name: com.mysql.jdbc.Driver |
||||
filters: stat |
||||
maxActive: 10 |
||||
initialSize: 5 |
||||
maxWait: 60000 |
||||
minIdle: 5 |
||||
timeBetweenEvictionRunsMillis: 60000 |
||||
minEvictableIdleTimeMillis: 300000 |
||||
validationQuery: select 'x' |
||||
testWhileIdle: true |
||||
testOnBorrow: false |
||||
testOnReturn: false |
||||
poolPreparedStatements: true |
||||
maxOpenPreparedStatements: 20 |
||||
|
||||
redis: |
||||
database: 1 |
||||
host: 127.0.0.1 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
timeout: 1000 |
||||
jedis: |
||||
pool: |
||||
max-active: 20 |
||||
max-wait: -1 |
||||
max-idle: 10 |
||||
min-idle: 0 |
||||
#配置日期返回至前台为时间戳 |
||||
jackson: |
||||
serialization: |
||||
write-dates-as-timestamps: true |
||||
|
||||
rocketmq: |
||||
name-server: 1.95.70.9:9876 |
||||
producer: |
||||
#必须指定group |
||||
group: default-group |
||||
|
||||
mybatis: |
||||
mapperLocations: |
||||
- classpath*:sqlmap*/*.xml |
||||
type-aliases-package: |
||||
org.springboot.sample.entity |
||||
|
||||
jetcache: |
||||
statIntervalMinutes: 15 |
||||
areaInCacheName: false |
||||
local: |
||||
default: |
||||
type: linkedhashmap |
||||
keyConvertor: fastjson |
||||
remote: |
||||
default: |
||||
type: redis |
||||
host: 127.0.0.1 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
keyConvertor: fastjson |
||||
broadcastChannel: projectA |
||||
valueEncoder: java |
||||
valueDecoder: java |
||||
poolConfig: |
||||
minIdle: 5 |
||||
maxIdle: 20 |
||||
maxTotal: 50 |
||||
|
||||
pagehelper: |
||||
helperDialect: mysql |
||||
reasonable: true |
||||
supportMethodsArguments: true |
||||
params: count=countSql |
@ -0,0 +1 @@ |
||||
fileUrl=/home/project/phg/filesystem |
@ -0,0 +1,72 @@ |
||||
<configuration> |
||||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<pattern>%d %p (%file:%line\)- %m%n</pattern> |
||||
<charset>UTF-8</charset> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="baselog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/base.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/base.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="daolog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/dao.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="errorlog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/error.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/error.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<root level="DEBUG"> |
||||
<appender-ref ref="STDOUT" /> |
||||
</root> |
||||
<logger name="com.cg" level="DEBUG"> |
||||
<appender-ref ref="baselog" /> |
||||
</logger> |
||||
<logger name="com.cg.dao" level="DEBUG"> |
||||
<appender-ref ref="daolog" /> |
||||
</logger> |
||||
<logger name="com.cg" level="ERROR"> |
||||
<appender-ref ref="errorlog" /> |
||||
</logger> |
||||
</configuration> |
@ -0,0 +1,45 @@ |
||||
<?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.cg</groupId> |
||||
<artifactId>cg-parent</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<groupId>com.cg</groupId> |
||||
<artifactId>cweb</artifactId> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.cg</groupId> |
||||
<artifactId>service</artifactId> |
||||
<version>PACKT-SNAPSHOT</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<resources> |
||||
<resource> |
||||
<directory>src/main/resources/${env}</directory> |
||||
<filtering>false</filtering> |
||||
</resource> |
||||
</resources> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-surefire-plugin</artifactId> |
||||
<configuration> |
||||
<skip>true</skip> |
||||
</configuration> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
@ -0,0 +1,30 @@ |
||||
package com; |
||||
|
||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; |
||||
import com.alicp.jetcache.anno.config.EnableMethodCache; |
||||
import com.cg.common.utils.SpringContextUtil; |
||||
import org.mybatis.spring.annotation.MapperScan; |
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.boot.web.servlet.ServletComponentScan; |
||||
import org.springframework.context.ApplicationContext; |
||||
import org.springframework.scheduling.annotation.EnableScheduling; |
||||
import org.springframework.transaction.annotation.EnableTransactionManagement; |
||||
|
||||
@SpringBootApplication |
||||
// @ComponentScan
|
||||
@EnableTransactionManagement |
||||
@EnableScheduling |
||||
@EnableMethodCache(basePackages = "com.cg") |
||||
@EnableCreateCacheAnnotation |
||||
@ServletComponentScan |
||||
@MapperScan("com.cg.dao") |
||||
public class CWebApplication |
||||
{ |
||||
public static void main( String[] args ) |
||||
{ |
||||
ApplicationContext app = SpringApplication.run(CWebApplication.class, args); |
||||
SpringContextUtil.setApplicationContext(app); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,130 @@ |
||||
package com.cweb.config; |
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
import com.fasterxml.jackson.databind.module.SimpleModule; |
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||
import com.cg.common.security.UserCenter; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.http.converter.HttpMessageConverter; |
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.List; |
||||
|
||||
@Configuration |
||||
public class AuthConfig implements WebMvcConfigurer { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(AuthConfig.class); |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
/** |
||||
* 获取配置文件debug变量 |
||||
*/ |
||||
@Value("${debug}") |
||||
private boolean debug = false; |
||||
|
||||
/** |
||||
* 解决18位long类型数据转json失去精度问题 |
||||
* @param converters |
||||
*/ |
||||
@Override |
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters){ |
||||
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); |
||||
|
||||
ObjectMapper objectMapper = jsonConverter.getObjectMapper(); |
||||
SimpleModule simpleModule = new SimpleModule(); |
||||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); |
||||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); |
||||
objectMapper.registerModule(simpleModule); |
||||
|
||||
converters.add(jsonConverter); |
||||
} |
||||
|
||||
public void addInterceptors(InterceptorRegistry registry) { |
||||
registry.addInterceptor(new HandlerInterceptorAdapter() { |
||||
|
||||
@Override |
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, |
||||
Object handler) throws Exception { |
||||
if(debug){ |
||||
return true; |
||||
} |
||||
String token = request.getHeader("Authorization"); |
||||
|
||||
if(StringUtils.isNotBlank(token) && userCenter.isLogin(token)){//如果未登录,将无法使用任何接口
|
||||
return true; |
||||
} else if(request instanceof StandardMultipartHttpServletRequest) { |
||||
StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request; |
||||
if(userCenter.isLogin(re.getRequest())){ |
||||
return true; |
||||
} else { |
||||
log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL()); |
||||
response.setStatus(401); |
||||
return false; |
||||
} |
||||
} else{ |
||||
log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL()); |
||||
response.setStatus(401); |
||||
return false; |
||||
} |
||||
} |
||||
}) |
||||
.addPathPatterns("/**") |
||||
.excludePathPatterns("/swagger-resources/**") |
||||
.excludePathPatterns("/**/api-docs") |
||||
.excludePathPatterns("/**/springfox-swagger-ui/**") |
||||
.excludePathPatterns("/**/swagger-ui.html") |
||||
.excludePathPatterns("/goods/*") |
||||
.excludePathPatterns("/cms/*") |
||||
.excludePathPatterns("/common/*") |
||||
.excludePathPatterns("/fileUpload/*") |
||||
.excludePathPatterns("/wxMsg/*") |
||||
.excludePathPatterns("/cinema/*") |
||||
; |
||||
} |
||||
|
||||
public 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 = ips[index]; |
||||
if (!("unknown".equalsIgnoreCase(strIp))) { |
||||
ip = strIp; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
return ip; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.cweb.config; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.ServletContextEvent; |
||||
import javax.servlet.ServletContextListener; |
||||
import javax.servlet.annotation.WebListener; |
||||
|
||||
@WebListener |
||||
public class ConfigListener implements ServletContextListener { |
||||
|
||||
@Resource |
||||
private SysConfig sysConfig; |
||||
|
||||
@Override |
||||
public void contextInitialized(ServletContextEvent sce) { |
||||
SysConst.setSysConfig(sysConfig); |
||||
} |
||||
|
||||
@Override |
||||
public void contextDestroyed(ServletContextEvent sce) { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.cweb.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.cors.CorsConfiguration; |
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||
import org.springframework.web.filter.CorsFilter; |
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @ClassName CorsConfig |
||||
* @Description: TODO () |
||||
* @Author 胡锐 |
||||
* @Date 2020/12/16 |
||||
**/ |
||||
@Configuration |
||||
public class CorsConfig extends WebMvcConfigurerAdapter { |
||||
@Override |
||||
public void addCorsMappings(CorsRegistry registry) { |
||||
registry.addMapping("/**") |
||||
.allowedOrigins("*") |
||||
.allowCredentials(true) |
||||
.allowedMethods("GET", "POST", "DELETE", "PUT") |
||||
.maxAge(3600); |
||||
} |
||||
private CorsConfiguration buildConfig() { |
||||
CorsConfiguration corsConfiguration = new CorsConfiguration(); |
||||
List<String> list = new ArrayList<>(); |
||||
list.add("*"); |
||||
corsConfiguration.setAllowedOrigins(list); |
||||
/* |
||||
// 请求常用的三种配置,*代表允许所有,当时你也可以自定义属性(比如header只能带什么,只能是post方式等等)
|
||||
*/ |
||||
corsConfiguration.addAllowedOrigin("*"); |
||||
corsConfiguration.addAllowedHeader("*"); |
||||
corsConfiguration.addAllowedMethod("*"); |
||||
return corsConfiguration; |
||||
} |
||||
@Bean |
||||
public CorsFilter corsFilter() { |
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
||||
source.registerCorsConfiguration("/**", buildConfig()); |
||||
return new CorsFilter(source); |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.cweb.config; |
||||
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import javax.servlet.MultipartConfigElement; |
||||
|
||||
@Configuration |
||||
public class MultipartConfig { |
||||
|
||||
/** |
||||
* 文件上传配置 |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public MultipartConfigElement multipartConfigElement() { |
||||
MultipartConfigFactory factory = new MultipartConfigFactory(); |
||||
//文件最大
|
||||
factory.setMaxFileSize("300MB"); //KB,MB
|
||||
//设置总上传数据总大小
|
||||
factory.setMaxRequestSize("350MB"); |
||||
return factory.createMultipartConfig(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,110 @@ |
||||
package com.cweb.config; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect; |
||||
import com.fasterxml.jackson.annotation.PropertyAccessor; |
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
import org.springframework.cache.annotation.CachingConfigurerSupport; |
||||
import org.springframework.cache.annotation.EnableCaching; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.data.redis.connection.RedisConnectionFactory; |
||||
import org.springframework.data.redis.core.*; |
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
||||
import org.springframework.data.redis.serializer.StringRedisSerializer; |
||||
|
||||
|
||||
@Configuration |
||||
@EnableCaching //开启注解
|
||||
public class RedisConfig extends CachingConfigurerSupport { |
||||
|
||||
/** |
||||
* retemplate相关配置 |
||||
* @param factory |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { |
||||
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>(); |
||||
// 配置连接工厂
|
||||
template.setConnectionFactory(factory); |
||||
|
||||
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
|
||||
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class); |
||||
|
||||
ObjectMapper om = new ObjectMapper(); |
||||
// 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
||||
// 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
|
||||
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); |
||||
jacksonSeial.setObjectMapper(om); |
||||
|
||||
// 值采用json序列化
|
||||
template.setValueSerializer(jacksonSeial); |
||||
//使用StringRedisSerializer来序列化和反序列化redis的key值
|
||||
template.setKeySerializer(new StringRedisSerializer()); |
||||
|
||||
// 设置hash key 和value序列化模式
|
||||
template.setHashKeySerializer(new StringRedisSerializer()); |
||||
template.setHashValueSerializer(jacksonSeial); |
||||
template.afterPropertiesSet(); |
||||
|
||||
return template; |
||||
} |
||||
|
||||
/** |
||||
* 对hash类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForHash(); |
||||
} |
||||
|
||||
/** |
||||
* 对redis字符串类型数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForValue(); |
||||
} |
||||
|
||||
/** |
||||
* 对链表类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForList(); |
||||
} |
||||
|
||||
/** |
||||
* 对无序集合类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForSet(); |
||||
} |
||||
|
||||
/** |
||||
* 对有序集合类型的数据操作 |
||||
* |
||||
* @param redisTemplate |
||||
* @return |
||||
*/ |
||||
@Bean |
||||
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) { |
||||
return redisTemplate.opsForZSet(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@ |
||||
package com.cweb.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import springfox.documentation.builders.ApiInfoBuilder; |
||||
import springfox.documentation.builders.RequestHandlerSelectors; |
||||
import springfox.documentation.service.ApiInfo; |
||||
import springfox.documentation.service.Contact; |
||||
import springfox.documentation.spi.DocumentationType; |
||||
import springfox.documentation.spring.web.plugins.Docket; |
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
||||
|
||||
/** |
||||
* SwaggerConfig.java |
||||
* 项目名称: |
||||
* 包: |
||||
* 类名称: SwaggerConfig.java |
||||
* 类描述: 构建restful api接口文档 |
||||
* 创建人: |
||||
* 创建时间: 2017 下午4:23:45 |
||||
*/ |
||||
@Configuration |
||||
@EnableSwagger2 |
||||
public class SwaggerConfig |
||||
{ |
||||
|
||||
/** |
||||
* 描述api的基本信息 |
||||
* 基本信息会展现在文档页面中 |
||||
* @return [api的基本信息] |
||||
*/ |
||||
ApiInfo apiInfo() |
||||
{ |
||||
return new ApiInfoBuilder().title("hgj-CWeb").description("提供给用户端的接口").termsOfServiceUrl("").version("1.0.0") |
||||
.contact(new Contact("", "", "")).build(); |
||||
} |
||||
|
||||
@Bean |
||||
public Docket customImplementation() |
||||
{ |
||||
return new Docket(DocumentationType.SWAGGER_2).select() |
||||
.apis(RequestHandlerSelectors.basePackage("com")) |
||||
.build().directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class) |
||||
.directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class).apiInfo(apiInfo()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.cweb.config; |
||||
|
||||
import lombok.Data; |
||||
import lombok.Getter; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.context.annotation.PropertySource; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component("sysConfig") |
||||
@ConfigurationProperties |
||||
@PropertySource("classpath:/config.properties") |
||||
@Data |
||||
public class SysConfig { |
||||
|
||||
private String fileUrl; |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.cweb.config; |
||||
|
||||
public class SysConst { |
||||
|
||||
private static SysConfig sysConfig; |
||||
|
||||
public static void setSysConfig(SysConfig arg){ |
||||
sysConfig = arg; |
||||
} |
||||
|
||||
public static SysConfig getSysConfig(){ |
||||
if (null == sysConfig) { |
||||
//防止空指针异常
|
||||
sysConfig = new SysConfig(); |
||||
return sysConfig; |
||||
} |
||||
return sysConfig; |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
package com.cweb.config; |
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService; |
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; |
||||
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import javax.annotation.PostConstruct; |
||||
|
||||
@Configuration |
||||
public class WxMaConfiguration { |
||||
|
||||
private static WxMaService maService; |
||||
|
||||
public static WxMaService getMaService() { |
||||
if (maService == null) { |
||||
throw new IllegalArgumentException(String.format("未找到对应的配置,请核实!")); |
||||
} |
||||
|
||||
return maService; |
||||
} |
||||
|
||||
@PostConstruct |
||||
public void init() { |
||||
/*WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
||||
config.setAppid(SysConst.getSysConfig().getWxAppId()); |
||||
config.setSecret(SysConst.getSysConfig().getWxAppSecret()); |
||||
|
||||
maService = new WxMaServiceImpl(); |
||||
maService.setWxMaConfig(config);*/ |
||||
} |
||||
|
||||
} |
@ -0,0 +1,60 @@ |
||||
package com.cweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.cg.common.utils.RedisUtil; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.CommonService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.*; |
||||
|
||||
@RestController |
||||
@RequestMapping(value="/common") |
||||
@Api(value="共用接口") |
||||
public class CommonController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(CommonController.class); |
||||
|
||||
@Resource |
||||
private CommonService commonService; |
||||
|
||||
@Autowired |
||||
private RedisUtil redisUtil; |
||||
|
||||
|
||||
@RequestMapping(value = "/getAllCity", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询所有城市") |
||||
public ResponseData getAllCity() { |
||||
try { |
||||
|
||||
Object data = redisUtil.get("regional"); |
||||
|
||||
if (data == null) { |
||||
|
||||
List<JSONObject> jsonObjects = commonService.getCity("key" , "title" , "children"); |
||||
redisUtil.set("regional", jsonObjects); |
||||
|
||||
return ResponseMsgUtil.success(jsonObjects); |
||||
|
||||
} else { |
||||
return ResponseMsgUtil.success(data); |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighUserCardController --> oilCardRefund() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,103 @@ |
||||
package com.cweb.controller; |
||||
|
||||
import com.cweb.config.SysConfig; |
||||
import com.cg.common.utils.DateUtil; |
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.config.CommonSysConst; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.FileUploadService; |
||||
import com.obs.services.model.PutObjectResult; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import net.coobird.thumbnailator.Thumbnails; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.File; |
||||
import java.io.FileInputStream; |
||||
import java.io.FileOutputStream; |
||||
import java.io.InputStream; |
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
@RestController |
||||
@RequestMapping(value="/fileUpload") |
||||
@Api(value="文件上传") |
||||
public class FileUploadController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(FileUploadController.class); |
||||
|
||||
@Resource |
||||
private SysConfig sysConfig; |
||||
|
||||
@RequestMapping(value = "/fileUpload", method = RequestMethod.POST) |
||||
@ApiOperation(value = "上传文件(超过3000KB压缩)") |
||||
@ResponseBody |
||||
public ResponseData fileUpload(@RequestParam(value = "files" , required = false) MultipartFile files, |
||||
HttpServletRequest request, |
||||
HttpServletResponse response |
||||
) { |
||||
try { |
||||
response.setHeader("Access-Control-Allow-Origin", "*"); |
||||
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver( |
||||
request.getSession().getServletContext()); |
||||
// 判断 request 是否有文件上传,即多部分请求
|
||||
List<String> fileNames = new ArrayList<String>(); |
||||
if (multipartResolver.isMultipart(request)) { |
||||
// 转换成多部分request
|
||||
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; |
||||
Iterator<String> iterator = multiRequest.getFileNames(); |
||||
|
||||
while (iterator.hasNext()) { |
||||
MultipartFile file = multiRequest.getFile(iterator.next()); |
||||
if (file != null) { |
||||
FileOutputStream out = null; |
||||
try { |
||||
String fileType = file.getOriginalFilename() |
||||
.substring(file.getOriginalFilename().lastIndexOf(".") + 1); |
||||
String fileName = System.currentTimeMillis() + "." + fileType; |
||||
String childPath = DateUtil.date2String(new Date(), "yyyyMM"); |
||||
String destDirName = sysConfig.getFileUrl() + File.separator + childPath; |
||||
File dir = new File(destDirName); |
||||
if (!dir.exists()) { |
||||
dir.mkdirs(); |
||||
} |
||||
out = new FileOutputStream(destDirName + File.separator + fileName); |
||||
out.write(file.getBytes()); |
||||
out.flush(); |
||||
fileNames.add(childPath + "/" + fileName); |
||||
// 图片压缩
|
||||
InputStream fis = new FileInputStream(destDirName + File.separator + fileName); |
||||
if (fis.available() > 3000000) { |
||||
Thumbnails.of(new FileInputStream(destDirName + File.separator + fileName)).scale(0.5).toFile(new File(destDirName + File.separator + fileName)); |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
} finally { |
||||
if (out != null) { |
||||
out.close(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
return ResponseMsgUtil.success(fileNames); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
package com.cweb.controller.cms; |
||||
|
||||
import com.cg.common.utils.ResponseMsgUtil; |
||||
import com.cg.model.ResponseData; |
||||
import com.cg.service.cms.CmsContentService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/cms") |
||||
@Api(value="cms") |
||||
public class CmsContentController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(CmsContentController.class); |
||||
|
||||
@Resource |
||||
private CmsContentService cmsContentService; |
||||
|
||||
@RequestMapping(value="/getCms",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData getCms(@RequestParam(value = "code" , required = false) String code, |
||||
@RequestParam(value = "platformCode" , required = false) String platformCode) { |
||||
try { |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("code", code); |
||||
if (platformCode == null) { |
||||
platformCode = "WXAPPLETS"; |
||||
} |
||||
map.put("platformCode", platformCode); |
||||
return ResponseMsgUtil.success(cmsContentService.getList(map)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,89 @@ |
||||
server: |
||||
port: 9701 |
||||
servlet: |
||||
context-path: /crest |
||||
|
||||
#配置是否为debug模式,debug模式下,不开启权限校验 |
||||
debug: false |
||||
|
||||
#datasource数据源设置 |
||||
spring: |
||||
datasource: |
||||
url: jdbc:mysql://139.9.154.68:3306/puhui_go?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false |
||||
username: root |
||||
password: HF123456. |
||||
type: com.alibaba.druid.pool.DruidDataSource |
||||
driver-class-name: com.mysql.jdbc.Driver |
||||
filters: stat |
||||
maxActive: 10 |
||||
initialSize: 5 |
||||
maxWait: 60000 |
||||
minIdle: 5 |
||||
timeBetweenEvictionRunsMillis: 60000 |
||||
minEvictableIdleTimeMillis: 300000 |
||||
validationQuery: select 'x' |
||||
testWhileIdle: true |
||||
testOnBorrow: false |
||||
testOnReturn: false |
||||
poolPreparedStatements: true |
||||
maxOpenPreparedStatements: 20 |
||||
redis: |
||||
database: 1 |
||||
host: 139.9.154.68 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
timeout: 1000 |
||||
jedis: |
||||
pool: |
||||
max-active: 20 |
||||
max-wait: -1 |
||||
max-idle: 10 |
||||
min-idle: 0 |
||||
#配置日期返回至前台为时间戳 |
||||
jackson: |
||||
serialization: |
||||
write-dates-as-timestamps: true |
||||
mybatis: |
||||
mapperLocations: |
||||
- classpath*:sqlmap*/*.xml |
||||
type-aliases-package: |
||||
org.springboot.sample.entity |
||||
|
||||
pagehelper: |
||||
helperDialect: mysql |
||||
reasonable: true |
||||
supportMethodsArguments: true |
||||
params: count=countSql |
||||
|
||||
rocketmq: |
||||
name-server: 139.9.154.68:9876 |
||||
producer: |
||||
access-key: huifukeji |
||||
secret-key: HF123456. |
||||
#必须指定group |
||||
group: default-group |
||||
consumer: |
||||
access-key: huifukeji |
||||
secret-key: HF123456. |
||||
|
||||
jetcache: |
||||
statIntervalMinutes: 15 |
||||
areaInCacheName: false |
||||
local: |
||||
default: |
||||
type: linkedhashmap |
||||
keyConvertor: fastjson |
||||
remote: |
||||
default: |
||||
type: redis |
||||
host: 139.9.154.68 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
keyConvertor: fastjson |
||||
broadcastChannel: projectA |
||||
valueEncoder: java |
||||
valueDecoder: java |
||||
poolConfig: |
||||
minIdle: 5 |
||||
maxIdle: 20 |
||||
maxTotal: 50 |
@ -0,0 +1 @@ |
||||
fileUrl=/home/project/phg/filesystem |
@ -0,0 +1,72 @@ |
||||
<configuration> |
||||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<pattern>%d %p (%file:%line\)- %m%n</pattern> |
||||
<charset>UTF-8</charset> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="baselog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/base.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/base.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="daolog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/dao.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="errorlog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/error.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/error.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<root level="DEBUG"> |
||||
<appender-ref ref="STDOUT" /> |
||||
</root> |
||||
<logger name="com.cg" level="DEBUG"> |
||||
<appender-ref ref="baselog" /> |
||||
</logger> |
||||
<logger name="com.cg.dao" level="DEBUG"> |
||||
<appender-ref ref="daolog" /> |
||||
</logger> |
||||
<logger name="com.cg" level="ERROR"> |
||||
<appender-ref ref="errorlog" /> |
||||
</logger> |
||||
</configuration> |
@ -0,0 +1,56 @@ |
||||
server: |
||||
port: 9301 |
||||
servlet: |
||||
context-path: /crest |
||||
|
||||
#配置是否为debug模式,debug模式下,不开启权限校验 |
||||
debug: false |
||||
|
||||
#datasource数据源设置 |
||||
spring: |
||||
datasource: |
||||
url: jdbc:mysql://139.9.154.68:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false |
||||
username: root |
||||
password: HF123456. |
||||
type: com.alibaba.druid.pool.DruidDataSource |
||||
driver-class-name: com.mysql.jdbc.Driver |
||||
filters: stat |
||||
maxActive: 10 |
||||
initialSize: 5 |
||||
maxWait: 60000 |
||||
minIdle: 5 |
||||
timeBetweenEvictionRunsMillis: 60000 |
||||
minEvictableIdleTimeMillis: 300000 |
||||
validationQuery: select 'x' |
||||
testWhileIdle: true |
||||
testOnBorrow: false |
||||
testOnReturn: false |
||||
poolPreparedStatements: true |
||||
maxOpenPreparedStatements: 20 |
||||
redis: |
||||
database: 1 |
||||
host: 139.9.154.68 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
timeout: 1000 |
||||
jedis: |
||||
pool: |
||||
max-active: 20 |
||||
max-wait: -1 |
||||
max-idle: 10 |
||||
min-idle: 0 |
||||
#配置日期返回至前台为时间戳 |
||||
jackson: |
||||
serialization: |
||||
write-dates-as-timestamps: true |
||||
mybatis: |
||||
mapperLocations: |
||||
- classpath*:sqlmap*/*.xml |
||||
type-aliases-package: |
||||
org.springboot.sample.entity |
||||
|
||||
pagehelper: |
||||
helperDialect: mysql |
||||
reasonable: true |
||||
supportMethodsArguments: true |
||||
params: count=countSql |
@ -0,0 +1 @@ |
||||
fileUrl=/home/project/hsg/filesystem |
@ -0,0 +1,72 @@ |
||||
<configuration> |
||||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<pattern>%d %p (%file:%line\)- %m%n</pattern> |
||||
<charset>UTF-8</charset> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="baselog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/base.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/base.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="daolog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/dao.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="errorlog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/error.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/error.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<root level="DEBUG"> |
||||
<appender-ref ref="STDOUT" /> |
||||
</root> |
||||
<logger name="com.cg" level="DEBUG"> |
||||
<appender-ref ref="baselog" /> |
||||
</logger> |
||||
<logger name="com.cg.dao" level="DEBUG"> |
||||
<appender-ref ref="daolog" /> |
||||
</logger> |
||||
<logger name="com.cg" level="ERROR"> |
||||
<appender-ref ref="errorlog" /> |
||||
</logger> |
||||
</configuration> |
@ -0,0 +1,86 @@ |
||||
server: |
||||
port: 9701 |
||||
servlet: |
||||
context-path: /crest |
||||
|
||||
#配置是否为debug模式,debug模式下,不开启权限校验 |
||||
debug: false |
||||
|
||||
#datasource数据源设置 |
||||
spring: |
||||
datasource: |
||||
url: jdbc:mysql://192.168.0.63:21100/phg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 |
||||
username: phg |
||||
password: HUfukeji123456!@# |
||||
type: com.alibaba.druid.pool.DruidDataSource |
||||
driver-class-name: com.mysql.jdbc.Driver |
||||
filters: stat |
||||
maxActive: 10 |
||||
initialSize: 5 |
||||
maxWait: 60000 |
||||
minIdle: 5 |
||||
timeBetweenEvictionRunsMillis: 60000 |
||||
minEvictableIdleTimeMillis: 300000 |
||||
validationQuery: select 'x' |
||||
testWhileIdle: true |
||||
testOnBorrow: false |
||||
testOnReturn: false |
||||
poolPreparedStatements: true |
||||
maxOpenPreparedStatements: 20 |
||||
|
||||
redis: |
||||
database: 1 |
||||
host: 127.0.0.1 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
timeout: 1000 |
||||
jedis: |
||||
pool: |
||||
max-active: 20 |
||||
max-wait: -1 |
||||
max-idle: 10 |
||||
min-idle: 0 |
||||
#配置日期返回至前台为时间戳 |
||||
jackson: |
||||
serialization: |
||||
write-dates-as-timestamps: true |
||||
|
||||
rocketmq: |
||||
name-server: 1.95.70.9:9876 |
||||
producer: |
||||
#必须指定group |
||||
group: default-group |
||||
|
||||
mybatis: |
||||
mapperLocations: |
||||
- classpath*:sqlmap*/*.xml |
||||
type-aliases-package: |
||||
org.springboot.sample.entity |
||||
|
||||
jetcache: |
||||
statIntervalMinutes: 15 |
||||
areaInCacheName: false |
||||
local: |
||||
default: |
||||
type: linkedhashmap |
||||
keyConvertor: fastjson |
||||
remote: |
||||
default: |
||||
type: redis |
||||
host: 127.0.0.1 |
||||
port: 36379 |
||||
password: HF123456.Redis |
||||
keyConvertor: fastjson |
||||
broadcastChannel: projectA |
||||
valueEncoder: java |
||||
valueDecoder: java |
||||
poolConfig: |
||||
minIdle: 5 |
||||
maxIdle: 20 |
||||
maxTotal: 50 |
||||
|
||||
pagehelper: |
||||
helperDialect: mysql |
||||
reasonable: true |
||||
supportMethodsArguments: true |
||||
params: count=countSql |
@ -0,0 +1 @@ |
||||
fileUrl=/home/project/phg/filesystem |
@ -0,0 +1,95 @@ |
||||
<configuration> |
||||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> |
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder> |
||||
<pattern>%d %p (%file:%line\)- %m%n</pattern> |
||||
<charset>UTF-8</charset> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="baselog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/base.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/base.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="daolog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/dao.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/dao.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<appender name="errorlog" |
||||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/error.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/error.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<root level="DEBUG"> |
||||
<appender-ref ref="STDOUT" /> |
||||
</root> |
||||
<logger name="com.cg" level="DEBUG"> |
||||
<appender-ref ref="baselog" /> |
||||
</logger> |
||||
<logger name="com.cg.dao" level="DEBUG"> |
||||
<appender-ref ref="daolog" /> |
||||
</logger> |
||||
<logger name="com.cg" level="ERROR"> |
||||
<appender-ref ref="errorlog" /> |
||||
</logger> |
||||
|
||||
|
||||
<!-- 千猪接口 --> |
||||
<appender name="QianZhuLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<File>log/QianZhuLog.log</File> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>log/QianZhuLog/QianZhuLog.log.%d.%i</fileNamePattern> |
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
<!-- or whenever the file size reaches 64 MB --> |
||||
<maxFileSize>64 MB</maxFileSize> |
||||
</timeBasedFileNamingAndTriggeringPolicy> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern> |
||||
%d %p (%file:%line\)- %m%n |
||||
</pattern> |
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
</encoder> |
||||
</appender> |
||||
<logger name="com.cg.qianzhu.channel.QianZhuService" level="INFO"> |
||||
<appender-ref ref="QianZhuLog" /> |
||||
</logger> |
||||
<!-- 千猪接口 --> |
||||
</configuration> |
@ -0,0 +1,68 @@ |
||||
<?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.cg</groupId> |
||||
<artifactId>cg-parent</artifactId> |
||||
<packaging>pom</packaging> |
||||
<version>1.0-SNAPSHOT</version> |
||||
|
||||
<parent> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-parent</artifactId> |
||||
<version>2.0.5.RELEASE</version> |
||||
<relativePath/> |
||||
</parent> |
||||
|
||||
|
||||
|
||||
<properties> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
||||
<springfox-version>2.6.1</springfox-version> |
||||
<joda-time-version>2.9.9</joda-time-version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>commons-net</groupId> |
||||
<artifactId>commons-net</artifactId> |
||||
<version>3.6</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>net.coobird</groupId> |
||||
<artifactId>thumbnailator</artifactId> |
||||
<version>0.4.8</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<version>4.12</version> |
||||
<!-- 表示开发的时候引入,发布的时候不会加载此包 --> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.binarywang</groupId> |
||||
<artifactId>weixin-java-mp</artifactId> |
||||
<version>3.8.0</version> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<defaultGoal>compile</defaultGoal> |
||||
</build> |
||||
|
||||
<modules> |
||||
<module>service</module> |
||||
<module>cweb</module> |
||||
<module>bweb</module> |
||||
</modules> |
||||
|
||||
|
||||
</project> |
@ -0,0 +1,260 @@ |
||||
<?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.cg</groupId> |
||||
<artifactId>cg-parent</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<artifactId>service</artifactId> |
||||
<version>PACKT-SNAPSHOT</version> |
||||
|
||||
<properties> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
||||
<java.version>1.8</java.version> |
||||
<springfox-version>2.6.1</springfox-version> |
||||
<joda-time-version>2.9.9</joda-time-version> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-jdbc</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.mybatis.spring.boot</groupId> |
||||
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||
<version>1.3.1</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-data-redis</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.alicp.jetcache</groupId> |
||||
<artifactId>jetcache-starter-redis</artifactId> |
||||
<version>2.5.0</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.rocketmq</groupId> |
||||
<artifactId>rocketmq-spring-boot-starter</artifactId> |
||||
<version>2.2.2</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.pagehelper</groupId> |
||||
<artifactId>pagehelper-spring-boot-starter</artifactId> |
||||
<version>1.2.10</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.aspectj</groupId> |
||||
<artifactId>aspectjweaver</artifactId> |
||||
<version>1.8.13</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>tk.mybatis</groupId> |
||||
<artifactId>mapper</artifactId> |
||||
<version>3.3.0</version> |
||||
</dependency> |
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> |
||||
<dependency> |
||||
<groupId>org.apache.httpcomponents</groupId> |
||||
<artifactId>httpclient</artifactId> |
||||
<version>4.5.3</version> |
||||
</dependency> |
||||
|
||||
<!-- mysql连接驱动 --> |
||||
<dependency> |
||||
<groupId>mysql</groupId> |
||||
<artifactId>mysql-connector-java</artifactId> |
||||
<version>5.1.34</version> |
||||
</dependency> |
||||
|
||||
<!-- druid连接池 --> |
||||
<dependency> |
||||
<groupId>com.alibaba</groupId> |
||||
<artifactId>druid</artifactId> |
||||
<version>1.0.20</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>io.springfox</groupId> |
||||
<artifactId>springfox-swagger2</artifactId> |
||||
<version>${springfox-version}</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>io.springfox</groupId> |
||||
<artifactId>springfox-swagger-ui</artifactId> |
||||
<version>${springfox-version}</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>joda-time</groupId> |
||||
<artifactId>joda-time</artifactId> |
||||
<version>${joda-time-version}</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-api</artifactId> |
||||
<version>1.7.25</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-simple</artifactId> |
||||
<version>1.7.25</version> |
||||
<scope>provided</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.commons</groupId> |
||||
<artifactId>commons-lang3</artifactId> |
||||
<version>3.7</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.commons</groupId> |
||||
<artifactId>commons-collections4</artifactId> |
||||
<version>4.2</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>commons-codec</groupId> |
||||
<artifactId>commons-codec</artifactId> |
||||
<version>1.10</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>commons-logging</groupId> |
||||
<artifactId>commons-logging</artifactId> |
||||
<version>1.2</version> |
||||
</dependency> |
||||
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload --> |
||||
<dependency> |
||||
<groupId>commons-fileupload</groupId> |
||||
<artifactId>commons-fileupload</artifactId> |
||||
<version>1.4</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<version>4.12</version> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>commons-io</groupId> |
||||
<artifactId>commons-io</artifactId> |
||||
<version>2.6</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.alibaba</groupId> |
||||
<artifactId>fastjson</artifactId> |
||||
<version>1.2.7</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.httpcomponents</groupId> |
||||
<artifactId>httpmime</artifactId> |
||||
<version>4.5.6</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.aliyun</groupId> |
||||
<artifactId>aliyun-java-sdk-core</artifactId> |
||||
<version>4.1.0</version> |
||||
</dependency> |
||||
|
||||
<dependency> |
||||
<groupId>dom4j</groupId> |
||||
<artifactId>dom4j</artifactId> |
||||
<version>1.6.1</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.poi</groupId> |
||||
<artifactId>poi</artifactId> |
||||
<version>4.1.2</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.poi</groupId> |
||||
<artifactId>poi-ooxml</artifactId> |
||||
<version>4.1.2</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.apache.poi</groupId> |
||||
<artifactId>poi-ooxml-schemas</artifactId> |
||||
<version>4.1.2</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.zxing</groupId> |
||||
<artifactId>javase</artifactId> |
||||
<version>3.3.0</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.google.code.gson</groupId> |
||||
<artifactId>gson</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.slf4j</groupId> |
||||
<artifactId>slf4j-api</artifactId> |
||||
<version>1.7.7</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.thoughtworks.xstream</groupId> |
||||
<artifactId>xstream</artifactId> |
||||
<version>1.4.11.1</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.binarywang</groupId> |
||||
<artifactId>weixin-java-miniapp</artifactId> |
||||
<version>3.8.0</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.alibaba</groupId> |
||||
<artifactId>easyexcel</artifactId> |
||||
<version>2.2.6</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.sun.jersey</groupId> |
||||
<artifactId>jersey-client</artifactId> |
||||
<version>1.16</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.projectlombok</groupId> |
||||
<artifactId>lombok</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.huaweicloud</groupId> |
||||
<artifactId>esdk-obs-java-bundle</artifactId> |
||||
<version>[3.21.8,)</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.aliyun</groupId> |
||||
<artifactId>ocr_api20210707</artifactId> |
||||
<version>1.1.1</version> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<resources> |
||||
<resource> |
||||
<directory>src/main/resources/${env}</directory> |
||||
<filtering>false</filtering> |
||||
</resource> |
||||
</resources> |
||||
</build> |
||||
</project> |
@ -0,0 +1,15 @@ |
||||
|
||||
domainName=https://phgcs.dctpay.com |
||||
|
||||
wechatMpAppid=wxa075e8509802f826 |
||||
wechatMpSecret=0e606fc1378d35e359fcf3f15570b2c5 |
||||
|
||||
wechatMaAppid=wx8d49e2f83025229d |
||||
wechatMaSecret=d8d6dcaef77d3b659258a01b5ddba5df |
||||
|
||||
obsBucketName=phg-test |
||||
obsEndPoint=https://obs.cn-southwest-2.myhuaweicloud.com |
||||
obsUrl=https://phg-test.obs.cn-southwest-2.myhuaweicloud.com |
||||
|
||||
huiPayPreorderNotifyUrl=https://phgcs.dctpay.com/order/notify/huipay |
||||
|
@ -0,0 +1,14 @@ |
||||
|
||||
domainName=https://phg.dctpay.com |
||||
|
||||
wechatMpAppid=wxa075e8509802f826 |
||||
wechatMpSecret=0e606fc1378d35e359fcf3f15570b2c5 |
||||
|
||||
wechatMaAppid=wx8d49e2f83025229d |
||||
wechatMaSecret=d8d6dcaef77d3b659258a01b5ddba5df |
||||
|
||||
obsBucketName=phg |
||||
obsEndPoint=https://obs.cn-southwest-2.myhuaweicloud.com |
||||
obsUrl=https://phg.obs.cn-southwest-2.myhuaweicloud.com |
||||
|
||||
huiPayPreorderNotifyUrl=https://phg.dctpay.com/order/notify/huipay |
Loading…
Reference in new issue