| @@ -5,4 +5,5 @@ logPath_IS_UNDEFINED/** | |||
| uploads/** | |||
| /.project | |||
| /.gitignore | |||
| *.iml | |||
| *.iml | |||
| .DS_Store | |||
| @@ -4,7 +4,7 @@ | |||
| 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> | |||
| <parent> | |||
| <parent> | |||
| <artifactId>mallink</artifactId> | |||
| <groupId>com.iformall</groupId> | |||
| <version>1.0</version> | |||
| @@ -18,7 +18,11 @@ | |||
| <artifactId>mallinkService</artifactId> | |||
| <version>1.0</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.iformall</groupId> | |||
| <artifactId>mybatis-multi-tenancy</artifactId> | |||
| <version>1.0</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| @@ -1,11 +1,11 @@ | |||
| package com.iformall; | |||
| import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties; | |||
| import org.mybatis.spring.annotation.MapperScan; | |||
| import org.springframework.boot.SpringApplication; | |||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
| import org.springframework.scheduling.annotation.EnableAsync; | |||
| import springfox.documentation.swagger2.annotations.EnableSwagger2; | |||
| import tk.mybatis.spring.annotation.MapperScan; | |||
| /** | |||
| * @author chenkx | |||
| @@ -15,7 +15,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | |||
| @MapperScan(basePackages = {"com.iformall.mapper"}) | |||
| @EnableSwagger2 | |||
| @EnableEncryptableProperties | |||
| @EnableAsync | |||
| public class UserApplication { | |||
| public static void main(String[] args) { | |||
| @@ -1,22 +0,0 @@ | |||
| package com.iformall.config; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import org.springframework.web.servlet.config.annotation.CorsRegistry; | |||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | |||
| /** | |||
| * Created by Administrator on 2017/8/9. | |||
| */ | |||
| @Configuration | |||
| public class CorsConfig extends WebMvcConfigurerAdapter { | |||
| @Override | |||
| public void addCorsMappings(CorsRegistry registry) { | |||
| registry.addMapping("/**") | |||
| .allowedOrigins("*") | |||
| .allowCredentials(true) | |||
| .allowedMethods("GET", "POST", "DELETE", "PUT") | |||
| .maxAge(3600); | |||
| } | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.iformall.config; | |||
| import com.iformall.plugin.MultiTenancy; | |||
| import org.apache.ibatis.reflection.MetaObject; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import java.util.Properties; | |||
| @Configuration | |||
| public class MyBatisConfiguration { | |||
| @Bean | |||
| public MultiTenancy multiTenancy() { | |||
| MultiTenancy multiTenancy = new MultiTenancy(); | |||
| Properties properties = new Properties(); | |||
| properties.setProperty("tenantIdColumn", "tenant_id"); | |||
| properties.setProperty("dialect", "mysql"); | |||
| properties.setProperty("tenantInfo", "com.iformall.tenant.TenantInfoImpl"); | |||
| multiTenancy.setProperties(properties); | |||
| return multiTenancy; | |||
| } | |||
| } | |||
| @@ -1,17 +1,30 @@ | |||
| package com.iformall.config; | |||
| import com.iformall.domain.po.PushLimit; | |||
| import com.iformall.domain.po.WxScoreRules; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.cache.CacheManager; | |||
| 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 redis.clients.jedis.JedisPool; | |||
| import redis.clients.jedis.JedisPoolConfig; | |||
| import org.springframework.data.redis.cache.RedisCacheConfiguration; | |||
| import org.springframework.data.redis.cache.RedisCacheManager; | |||
| import org.springframework.data.redis.cache.RedisCacheWriter; | |||
| import org.springframework.data.redis.connection.RedisConnectionFactory; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | |||
| import org.springframework.data.redis.serializer.StringRedisSerializer; | |||
| import java.time.Duration; | |||
| import java.util.HashMap; | |||
| import java.util.HashSet; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| /** | |||
| * Created by yangqj on 2017/4/30. | |||
| * Created by Stormeye on 2018/10/1. | |||
| */ | |||
| @Configuration | |||
| @EnableCaching | |||
| @@ -19,36 +32,81 @@ public class RedisConfig extends CachingConfigurerSupport { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Value("${spring.redis.host}") | |||
| private String host; | |||
| //缓存管理器 | |||
| @Bean | |||
| public CacheManager cacheManager(RedisConnectionFactory connectionFactory) { | |||
| /* | |||
| //user信息缓存配置 | |||
| RedisCacheConfiguration userCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(10)).disableCachingNullValues().prefixKeysWith("user"); | |||
| Map<String, RedisCacheConfiguration> redisCacheConfigurationMap = new HashMap<>(); | |||
| redisCacheConfigurationMap.put("user", userCacheConfiguration); | |||
| //初始化一个RedisCacheWriter | |||
| RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); | |||
| // 设置CacheManager的值序列化方式为JdkSerializationRedisSerializer,但其实RedisCacheConfiguration默认就是使用StringRedisSerializer序列化key,JdkSerializationRedisSerializer序列化value,所以以下注释代码为默认实现 | |||
| // ClassLoader loader = this.getClass().getClassLoader(); | |||
| // JdkSerializationRedisSerializer jdkSerializer = new JdkSerializationRedisSerializer(loader); | |||
| // RedisSerializationContext.SerializationPair<Object> pair = RedisSerializationContext.SerializationPair.fromSerializer(jdkSerializer); | |||
| // RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(pair); | |||
| RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig(); | |||
| //设置默认超过期时间是30秒 | |||
| defaultCacheConfig.entryTtl(Duration.ofSeconds(30)); | |||
| //初始化RedisCacheManager | |||
| RedisCacheManager cacheManager = new RedisCacheManager(redisCacheWriter, defaultCacheConfig, redisCacheConfigurationMap); | |||
| return cacheManager; | |||
| */ | |||
| RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig(); // 生成一个默认配置,通过config对象即可对缓存进行自定义配置 | |||
| config = config.entryTtl(Duration.ofMinutes(1)) // 设置缓存的默认过期时间,也是使用Duration设置 | |||
| .disableCachingNullValues(); // 不缓存空值 | |||
| @Value("${spring.redis.port}") | |||
| private int port; | |||
| // 设置一个初始化的缓存空间set集合 | |||
| Set<String> cacheNames = new HashSet<>(); | |||
| cacheNames.add("my-redis-cache1"); | |||
| cacheNames.add("my-redis-cache2"); | |||
| @Value("${spring.redis.timeout}") | |||
| private int timeout; | |||
| // 对每个缓存空间应用不同的配置 | |||
| Map<String, RedisCacheConfiguration> configMap = new HashMap<>(); | |||
| configMap.put("my-redis-cache1", config); | |||
| configMap.put("my-redis-cache2", config.entryTtl(Duration.ofSeconds(120))); | |||
| @Value("${spring.redis.pool.max-idle}") | |||
| private int maxIdle; | |||
| RedisCacheManager cacheManager = RedisCacheManager.builder(connectionFactory) // 使用自定义的缓存配置初始化一个cacheManager | |||
| .initialCacheNames(cacheNames) // 注意这两句的调用顺序,一定要先调用该方法设置初始化的缓存名,再初始化相关的配置 | |||
| .withInitialCacheConfigurations(configMap) | |||
| .build(); | |||
| return cacheManager; | |||
| } | |||
| @Value("${spring.redis.pool.max-wait}") | |||
| private long maxWaitMillis; | |||
| @Value("${spring.redis.password}") | |||
| private String password; | |||
| @Bean("pushLimitRedisTemplate") | |||
| public RedisTemplate<String, PushLimit> getPushLimitRedisTemplate(RedisConnectionFactory connectionFactory) { | |||
| RedisTemplate<String, PushLimit> template = new RedisTemplate<String, PushLimit>(); | |||
| @Bean | |||
| public JedisPool redisPoolFactory() { | |||
| logger.info("JedisPool注入成功!!"); | |||
| logger.info("redis地址:" + host + ":" + port); | |||
| JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); | |||
| jedisPoolConfig.setMaxIdle(maxIdle); | |||
| jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); | |||
| Jackson2JsonRedisSerializer<PushLimit> j = new Jackson2JsonRedisSerializer<PushLimit>(PushLimit.class); | |||
| // value值的序列化 | |||
| template.setValueSerializer(j); | |||
| template.setHashKeySerializer(j); | |||
| JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout,password); | |||
| // key的序列化 | |||
| template.setKeySerializer(new StringRedisSerializer()); | |||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||
| return jedisPool; | |||
| template.setConnectionFactory(connectionFactory); | |||
| return template; | |||
| } | |||
| @Bean("scoreRuleRedisTemplate") | |||
| public RedisTemplate<String, WxScoreRules> getScoreRuleRedisTemplate(RedisConnectionFactory connectionFactory) { | |||
| RedisTemplate<String, WxScoreRules> template = new RedisTemplate<String, WxScoreRules>(); | |||
| Jackson2JsonRedisSerializer<WxScoreRules> j = new Jackson2JsonRedisSerializer<WxScoreRules>(WxScoreRules.class); | |||
| // value值的序列化 | |||
| template.setValueSerializer(j); | |||
| template.setHashKeySerializer(j); | |||
| // key的序列化 | |||
| template.setKeySerializer(new StringRedisSerializer()); | |||
| template.setHashKeySerializer(new StringRedisSerializer()); | |||
| template.setConnectionFactory(connectionFactory); | |||
| return template; | |||
| } | |||
| } | |||
| @@ -1,8 +1,8 @@ | |||
| package com.iformall.config; | |||
| import com.iformall.service.MallPermissionService; | |||
| import com.iformall.shiro.MyRetryLimitCredentialsMatcher; | |||
| import com.iformall.shiro.MyShiroRealm; | |||
| import org.apache.shiro.authc.credential.HashedCredentialsMatcher; | |||
| import org.apache.shiro.mgt.SecurityManager; | |||
| import org.apache.shiro.spring.LifecycleBeanPostProcessor; | |||
| import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; | |||
| @@ -14,6 +14,7 @@ import org.crazycake.shiro.RedisCacheManager; | |||
| import org.crazycake.shiro.RedisManager; | |||
| import org.crazycake.shiro.RedisSessionDAO; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| @@ -41,12 +42,12 @@ public class ShiroConfig { | |||
| @Value("${spring.redis.timeout}") | |||
| private int timeout; | |||
| @Value("${spring.redis.expire}") | |||
| private int expire; | |||
| @Value("${spring.redis.password}") | |||
| private String password; | |||
| @Value("${spring.redis.password}") | |||
| private String password; | |||
| @Bean | |||
| public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() { | |||
| @@ -61,44 +62,46 @@ public class ShiroConfig { | |||
| // public ShiroDialect shiroDialect() { | |||
| // return new ShiroDialect(); | |||
| // } | |||
| /** | |||
| * ShiroFilterFactoryBean 处理拦截资源文件问题。 | |||
| * 注意:单独一个ShiroFilterFactoryBean配置是或报错的,因为在 | |||
| * 初始化ShiroFilterFactoryBean的时候需要注入:SecurityManager | |||
| * | |||
| Filter Chain定义说明 | |||
| 1、一个URL可以配置多个Filter,使用逗号分隔 | |||
| 2、当设置多个过滤器时,全部验证通过,才视为通过 | |||
| 3、部分过滤器可指定参数,如perms,roles | |||
| * | |||
| * <p> | |||
| * Filter Chain定义说明 | |||
| * 1、一个URL可以配置多个Filter,使用逗号分隔 | |||
| * 2、当设置多个过滤器时,全部验证通过,才视为通过 | |||
| * 3、部分过滤器可指定参数,如perms,roles | |||
| */ | |||
| @Bean | |||
| public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager){ | |||
| public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) { | |||
| System.out.println("ShiroConfiguration.shirFilter()"); | |||
| ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); | |||
| ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); | |||
| // 必须设置 SecurityManager | |||
| shiroFilterFactoryBean.setSecurityManager(securityManager); | |||
| Map<String, Filter> filters = new LinkedHashMap<String, Filter>(); | |||
| filters.put("token", new ShiroLoginFilter()); | |||
| filters.put("corsFilter", new RestFilter()); | |||
| shiroFilterFactoryBean.setFilters(filters); | |||
| filters.put("token", new ShiroLoginFilter()); | |||
| filters.put("corsFilter", new RestFilter()); | |||
| //filters.put("authc", new MyFormAuthenticationFilter()); | |||
| shiroFilterFactoryBean.setFilters(filters); | |||
| // 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面 | |||
| shiroFilterFactoryBean.setLoginUrl("/#/"); | |||
| // 登录成功后要跳转的链接 | |||
| shiroFilterFactoryBean.setSuccessUrl("/usersPage"); | |||
| //未授权界面; | |||
| shiroFilterFactoryBean.setUnauthorizedUrl("/403"); | |||
| //拦截器. | |||
| Map<String,String> filterChainDefinitionMap = new LinkedHashMap<String,String>(); | |||
| Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>(); | |||
| //配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了 | |||
| filterChainDefinitionMap.put("/logout", "anon"); | |||
| filterChainDefinitionMap.put("/doLogin/**","anon"); | |||
| filterChainDefinitionMap.put("/css/**","anon"); | |||
| filterChainDefinitionMap.put("/js/**","anon"); | |||
| filterChainDefinitionMap.put("/img/**","anon"); | |||
| filterChainDefinitionMap.put("/font-awesome/**","anon"); | |||
| filterChainDefinitionMap.put("/doLogin/**", "anon"); | |||
| filterChainDefinitionMap.put("/bHidLogin/**", "anon"); | |||
| filterChainDefinitionMap.put("/css/**", "anon"); | |||
| filterChainDefinitionMap.put("/js/**", "anon"); | |||
| filterChainDefinitionMap.put("/img/**", "anon"); | |||
| filterChainDefinitionMap.put("/font-awesome/**", "anon"); | |||
| //<!-- 过滤链定义,从上向下顺序执行,一般将 /**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了; | |||
| //<!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问--> | |||
| //自定义加载权限资源关系 | |||
| @@ -111,17 +114,18 @@ public class ShiroConfig { | |||
| // filterChainDefinitionMap.put(resources.getUrl(),permission); | |||
| // } | |||
| // } | |||
| filterChainDefinitionMap.put("/swagger-ui.html","anon"); | |||
| filterChainDefinitionMap.put("/swagger-ui.html", "anon"); | |||
| filterChainDefinitionMap.put("/wxPay/notify/**", "anon"); | |||
| filterChainDefinitionMap.put("/v2/**","anon"); | |||
| filterChainDefinitionMap.put("/swagger-resources/**","anon"); | |||
| filterChainDefinitionMap.put("/webjars/**","anon"); | |||
| filterChainDefinitionMap.put("/wxMsgCallback/**","anon"); | |||
| filterChainDefinitionMap.put("/user/sendvalidationcode","anon"); | |||
| filterChainDefinitionMap.put("/user/updatepwd","anon"); | |||
| filterChainDefinitionMap.put("/carCallback/**","anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/add","anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/sendvalidationcode","anon"); | |||
| filterChainDefinitionMap.put("/wxPayBill/notify/**", "anon"); | |||
| filterChainDefinitionMap.put("/v2/**", "anon"); | |||
| filterChainDefinitionMap.put("/swagger-resources/**", "anon"); | |||
| filterChainDefinitionMap.put("/webjars/**", "anon"); | |||
| filterChainDefinitionMap.put("/wxMsgCallback/**", "anon"); | |||
| filterChainDefinitionMap.put("/user/sendvalidationcode", "anon"); | |||
| filterChainDefinitionMap.put("/user/updatepwd", "anon"); | |||
| filterChainDefinitionMap.put("/carCallback/**", "anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/add", "anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/sendvalidationcode", "anon"); | |||
| filterChainDefinitionMap.put("/captcha.jpg", "anon"); | |||
| filterChainDefinitionMap.put("/version", "anon"); | |||
| // filterChainDefinitionMap.put("/role/**", "corsFilter,token"); | |||
| @@ -129,29 +133,26 @@ public class ShiroConfig { | |||
| // filterChainDefinitionMap.put("/**", "anon"); | |||
| shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); | |||
| return shiroFilterFactoryBean; | |||
| } | |||
| public static boolean isAjax(ServletRequest request){ | |||
| public static boolean isAjax(ServletRequest request) { | |||
| String header = ((HttpServletRequest) request).getHeader("X-Requested-With"); | |||
| if("XMLHttpRequest".equalsIgnoreCase(header)){ | |||
| System.out.println( "当前请求为Ajax请求"); | |||
| if ("XMLHttpRequest".equalsIgnoreCase(header)) { | |||
| System.out.println("当前请求为Ajax请求"); | |||
| return Boolean.TRUE; | |||
| } | |||
| System.out.println( "当前请求非Ajax请求"); | |||
| System.out.println("当前请求非Ajax请求"); | |||
| return Boolean.FALSE; | |||
| } | |||
| @Bean | |||
| public SecurityManager securityManager(){ | |||
| DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); | |||
| public SecurityManager securityManager(@Qualifier("myRetryLimitCredentialsMatcher") MyRetryLimitCredentialsMatcher matcher) { | |||
| DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); | |||
| //设置realm. | |||
| securityManager.setRealm(myShiroRealm()); | |||
| securityManager.setRealm(myShiroRealm(matcher)); | |||
| // 自定义缓存实现 使用redis | |||
| //securityManager.setCacheManager(cacheManager()); | |||
| // 自定义session管理 使用redis | |||
| @@ -160,24 +161,24 @@ public class ShiroConfig { | |||
| } | |||
| @Bean | |||
| public MyShiroRealm myShiroRealm(){ | |||
| public MyShiroRealm myShiroRealm(MyRetryLimitCredentialsMatcher matcher) { | |||
| MyShiroRealm myShiroRealm = new MyShiroRealm(); | |||
| myShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher()); | |||
| myShiroRealm.setCredentialsMatcher(matcher); | |||
| return myShiroRealm; | |||
| } | |||
| /** | |||
| * 凭证匹配器 | |||
| * 密码匹配凭证管理器 凭证匹配器 | |||
| * (由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了 | |||
| * 所以我们需要修改下doGetAuthenticationInfo中的代码; | |||
| * 所以我们需要修改下doGetAuthenticationInfo中的代码; | |||
| * ) | |||
| * | |||
| * @return | |||
| */ | |||
| @Bean | |||
| public HashedCredentialsMatcher hashedCredentialsMatcher(){ | |||
| HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher(); | |||
| @Bean(name = "myRetryLimitCredentialsMatcher") | |||
| public MyRetryLimitCredentialsMatcher hashedCredentialsMatcher() { | |||
| MyRetryLimitCredentialsMatcher hashedCredentialsMatcher = new MyRetryLimitCredentialsMatcher(); | |||
| hashedCredentialsMatcher.setHashAlgorithmName("md5");//散列算法:这里使用MD5算法; | |||
| hashedCredentialsMatcher.setHashIterations(2);//散列的次数,比如散列两次,相当于 md5(md5("")); | |||
| @@ -187,13 +188,14 @@ public class ShiroConfig { | |||
| /** | |||
| * 开启shiro aop注解支持. | |||
| * 使用代理方式;所以需要开启代码支持; | |||
| * 开启shiro aop注解支持. | |||
| * 使用代理方式;所以需要开启代码支持; | |||
| * | |||
| * @param securityManager | |||
| * @return | |||
| */ | |||
| @Bean | |||
| public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){ | |||
| public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) { | |||
| AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor(); | |||
| authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); | |||
| return authorizationAttributeSourceAdvisor; | |||
| @@ -202,6 +204,7 @@ public class ShiroConfig { | |||
| /** | |||
| * 配置shiro redisManager | |||
| * 使用的是shiro-redis开源插件 | |||
| * | |||
| * @return | |||
| */ | |||
| public RedisManager redisManager() { | |||
| @@ -217,6 +220,7 @@ public class ShiroConfig { | |||
| /** | |||
| * cacheManager 缓存 redis实现 | |||
| * 使用的是shiro-redis开源插件 | |||
| * | |||
| * @return | |||
| */ | |||
| public RedisCacheManager cacheManager() { | |||
| @@ -238,7 +242,7 @@ public class ShiroConfig { | |||
| } | |||
| /** | |||
| * shiro session的管理 | |||
| * shiro session的管理 | |||
| */ | |||
| @Bean | |||
| public DefaultWebSessionManager sessionManager() { | |||
| @@ -252,14 +256,14 @@ public class ShiroConfig { | |||
| sessionManager.setSessionIdCookie(simpleCookie()); | |||
| return sessionManager; | |||
| } | |||
| @Bean | |||
| public SimpleCookie simpleCookie() { | |||
| SimpleCookie simpleCookie = new SimpleCookie("SSIDS"); | |||
| SimpleCookie simpleCookie = new SimpleCookie("SSIDS"); | |||
| simpleCookie.setDomain(""); | |||
| return simpleCookie; | |||
| return simpleCookie; | |||
| } | |||
| // @Bean | |||
| // public SimpleCookie rememberMeCookie(){ | |||
| // //System.out.println("ShiroConfiguration.rememberMeCookie()"); | |||
| @@ -269,7 +273,7 @@ public class ShiroConfig { | |||
| // simpleCookie.setMaxAge(60*30); | |||
| // return simpleCookie; | |||
| // } | |||
| // @Bean | |||
| // public CookieRememberMeManager rememberMeManager(){ | |||
| // //System.out.println("ShiroConfiguration.rememberMeManager()"); | |||
| @@ -279,7 +283,7 @@ public class ShiroConfig { | |||
| // cookieRememberMeManager.setCipherKey(Base64.decodeBytes("2AvVhdsgUs0FSA3SDFAdag==")); | |||
| // return cookieRememberMeManager; | |||
| // } | |||
| // @Bean(name = "securityManager") | |||
| // public DefaultWebSecurityManager defaultWebSecurityManager(MyShiroRealm realm){ | |||
| // DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); | |||
| @@ -1,33 +1,78 @@ | |||
| package com.iformall.config; | |||
| import com.alibaba.fastjson.serializer.SerializeConfig; | |||
| import com.alibaba.fastjson.serializer.ToStringSerializer; | |||
| import com.alibaba.fastjson.support.config.FastJsonConfig; | |||
| import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; | |||
| import com.fasterxml.jackson.annotation.JsonInclude; | |||
| import com.fasterxml.jackson.databind.DeserializationConfig; | |||
| import com.fasterxml.jackson.databind.DeserializationFeature; | |||
| import com.fasterxml.jackson.databind.ObjectMapper; | |||
| import com.fasterxml.jackson.databind.module.SimpleModule; | |||
| import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import org.springframework.http.converter.HttpMessageConverter; | |||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | |||
| import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | |||
| import org.springframework.web.servlet.config.annotation.CorsRegistry; | |||
| import org.springframework.web.servlet.config.annotation.EnableWebMvc; | |||
| import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | |||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |||
| import java.math.BigDecimal; | |||
| import java.math.BigInteger; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.List; | |||
| @Configuration | |||
| public class WebConfig extends WebMvcConfigurerAdapter { | |||
| @EnableWebMvc | |||
| public class WebConfig implements WebMvcConfigurer { | |||
| @Override | |||
| public void addResourceHandlers(ResourceHandlerRegistry registry) { | |||
| registry.addResourceHandler("swagger-ui.html") | |||
| .addResourceLocations("classpath:/META-INF/resources/"); | |||
| registry.addResourceHandler("/webjars/**") | |||
| .addResourceLocations("classpath:/META-INF/resources/webjars/"); | |||
| //registry.addResourceHandler("/app/**").addResourceLocations("classpath:/app/"); | |||
| } | |||
| @Override | |||
| public void addCorsMappings(CorsRegistry registry) { | |||
| registry.addMapping("/**") | |||
| .allowedOrigins("*") | |||
| .allowCredentials(true) | |||
| .allowedMethods("GET", "POST", "DELETE", "PUT") | |||
| .maxAge(3600); | |||
| } | |||
| @Override | |||
| public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | |||
| FastJsonHttpMessageConverter fastConverter = | |||
| new FastJsonHttpMessageConverter(); | |||
| FastJsonConfig fastJsonConfig = new FastJsonConfig(); | |||
| SerializeConfig serializeConfig = SerializeConfig.globalInstance; | |||
| serializeConfig.put(BigInteger.class, ToStringSerializer.instance); | |||
| serializeConfig.put(Long.class, ToStringSerializer.instance); | |||
| serializeConfig.put(Long.TYPE, ToStringSerializer.instance); | |||
| fastJsonConfig.setSerializeConfig(serializeConfig); | |||
| fastConverter.setFastJsonConfig(fastJsonConfig); | |||
| converters.add(fastConverter); | |||
| MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); | |||
| //ObjectMapper 是Jackson库的主要类。它提供一些功能将转换成Java对象匹配JSON结构,反之亦然 | |||
| ObjectMapper objectMapper = new ObjectMapper(); | |||
| SimpleModule simpleModule = new SimpleModule(); | |||
| //不显示为null的字段 | |||
| objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | |||
| DeserializationConfig dc = objectMapper.getDeserializationConfig(); | |||
| // 设置反序列化日期格式、忽略不存在get、set的属性 | |||
| objectMapper.setConfig( | |||
| dc.with(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")) | |||
| .without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) | |||
| ); | |||
| //序列化将Long转String类型 | |||
| simpleModule.addSerializer(Long.class, ToStringSerializer.instance); | |||
| simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); | |||
| SimpleModule bigIntegerModule = new SimpleModule(); | |||
| //序列化将BigInteger转String类型 | |||
| bigIntegerModule.addSerializer(BigInteger.class, ToStringSerializer.instance); | |||
| SimpleModule bigDecimalModule = new SimpleModule(); | |||
| //序列化将BigDecimal转String类型 | |||
| bigDecimalModule.addSerializer(BigDecimal.class, ToStringSerializer.instance); | |||
| objectMapper.registerModule(simpleModule); | |||
| objectMapper.registerModule(bigDecimalModule); | |||
| objectMapper.registerModule(bigIntegerModule); | |||
| jackson2HttpMessageConverter.setObjectMapper(objectMapper); | |||
| converters.add(jackson2HttpMessageConverter); | |||
| } | |||
| @@ -7,10 +7,15 @@ import java.util.Date; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.shiro.UserSession; | |||
| import com.iformall.utils.IPUtil; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.springframework.web.bind.WebDataBinder; | |||
| import org.springframework.web.bind.annotation.InitBinder; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.context.request.RequestContextHolder; | |||
| import org.springframework.web.context.request.ServletRequestAttributes; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| @RestController | |||
| public class BaseController { | |||
| @@ -41,7 +46,13 @@ public class BaseController { | |||
| } | |||
| public String getTenantId(){ | |||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| return user.getTenantId(); | |||
| String tenantId = (String)SecurityUtils.getSubject().getSession().getAttribute(UserSession.tenantId); | |||
| return tenantId; | |||
| } | |||
| public String getIpAddr() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String ipaddress = IPUtil.getIpAddr(request); | |||
| return ipaddress; | |||
| } | |||
| } | |||
| @@ -8,6 +8,7 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -23,10 +24,31 @@ public class DataTowerController extends BaseController { | |||
| @Autowired | |||
| private DataTowerService dataTowerService; | |||
| @ApiOperation("查询运营") | |||
| @PostMapping("/queryRunningPotal") | |||
| public ResultData queryRunningPotal() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryRunningPotal"); | |||
| Map<String, Object> data = dataTowerService.queryRunningPotal(getTenantId()); | |||
| return new ResultData(data); | |||
| } | |||
| @ApiOperation("查询运营") | |||
| @PostMapping("/queryRunningMobile") | |||
| public ResultData queryRunningMobile() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryRunningMobile"); | |||
| Map<String, Object> data = dataTowerService.queryRunningMobile(getTenantId()); | |||
| return new ResultData(data); | |||
| } | |||
| @ApiOperation("查询运营") | |||
| @PostMapping("/queryRunning") | |||
| public ResultData queryRunning() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryRunning"); | |||
| Map<String, Object> data = dataTowerService.queryRunning(getTenantId()); | |||
| @@ -37,6 +59,7 @@ public class DataTowerController extends BaseController { | |||
| @ApiOperation("查询车流") | |||
| @PostMapping("/queryCar") | |||
| public ResultData queryCar() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryCar"); | |||
| Map<String, Object> data = dataTowerService.queryCar(getTenantId()); | |||
| @@ -46,11 +69,20 @@ public class DataTowerController extends BaseController { | |||
| @ApiOperation("查询客流") | |||
| @PostMapping("/queryCustomer") | |||
| public ResultData queryCustomer() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryCustomer"); | |||
| Map<String, Object> data = dataTowerService.queryCustomer(getTenantId()); | |||
| return new ResultData(data); | |||
| } | |||
| @ApiOperation("查询客流") | |||
| @PostMapping("/queryCustomerData") | |||
| public ResultData queryCustomerData(@RequestBody Map<String, String> params) { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryCustomer"); | |||
| return dataTowerService.queryCustomerData(getTenantId(), params); | |||
| } | |||
| } | |||
| @@ -8,14 +8,18 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallRolePermission; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.MallUserRole; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.MallRolePermissionService; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import com.iformall.service.MallUserRoleService; | |||
| import com.iformall.shiro.UserSession; | |||
| import com.iformall.shiro.UseriFormallToken; | |||
| import com.iformall.utils.ShiroUtils; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.UsernamePasswordToken; | |||
| import org.apache.shiro.subject.Subject; | |||
| @@ -23,7 +27,6 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.util.StringUtils; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.imageio.ImageIO; | |||
| @@ -36,7 +39,7 @@ import java.io.IOException; | |||
| @RestController | |||
| @Api(description = "登录相关接口") | |||
| public class HomeController { | |||
| public class HomeController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Value("${version}") | |||
| @@ -45,6 +48,9 @@ public class HomeController { | |||
| @Autowired | |||
| private Producer producer; | |||
| @Autowired | |||
| private MallUserInfoService mallUserInfoService; | |||
| @Autowired | |||
| private MallUserRoleService mallUserRoleService; | |||
| @@ -53,6 +59,7 @@ public class HomeController { | |||
| @GetMapping("/captcha.jpg") | |||
| public void captcha(HttpServletResponse response)throws ServletException, IOException { | |||
| logger.debug("[" + getIpAddr() + "] HomeController::captcha"); | |||
| response.setHeader("Cache-Control", "no-store, no-cache"); | |||
| response.setContentType("image/jpeg"); | |||
| @@ -71,6 +78,7 @@ public class HomeController { | |||
| @ApiOperation("登录") | |||
| @PostMapping("/doLogin") | |||
| public ResultData login(@RequestBody MallUserInfo user) { | |||
| logger.debug("[" + getIpAddr() + "] HomeController::login"); | |||
| try { | |||
| String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); | |||
| if(!user.getCaptcha().equalsIgnoreCase(kaptcha)){ | |||
| @@ -83,7 +91,7 @@ public class HomeController { | |||
| ResultData data = new ResultData(); | |||
| if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | |||
| if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) { | |||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | |||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||
| } | |||
| @@ -126,9 +134,73 @@ public class HomeController { | |||
| return data; | |||
| } | |||
| @ApiOperation("B端登录") | |||
| @PostMapping("/bHidLogin") | |||
| public ResultData bLogin(@RequestBody MallUserInfo user) { | |||
| logger.debug("[" + getIpAddr() + "] HomeController::bHidLogin"); | |||
| ResultData data = new ResultData(); | |||
| if(StringUtils.isNotBlank(user.getPhone())) { | |||
| // 领导登录 | |||
| user = mallUserInfoService.getByPhone(user.getPhone()); | |||
| if(!user.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN); | |||
| } | |||
| } else if(StringUtils.isNotBlank(user.getOpenId())) { | |||
| // 领导登录 | |||
| user = mallUserInfoService.getByOpenId(user.getOpenId()); | |||
| if(!user.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN); | |||
| } | |||
| } else { | |||
| if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | |||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | |||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||
| } | |||
| } | |||
| try { | |||
| Subject subject = SecurityUtils.getSubject(); | |||
| UseriFormallToken token = new UseriFormallToken(user.getUsername()); | |||
| subject.login(token); | |||
| // List<MallRole> roleList = sysRoleService.findRoleByUserId(user.getId()); | |||
| // if (null != roleList && roleList.size() > 0) { | |||
| // List<MallPermission> permissionList = sysPermissionService | |||
| // .findPermissionByRoleIds(roleList.stream().map(MallRole::getId).collect(Collectors.toList())); | |||
| // user.setRole(roleList); | |||
| // user.setPermission(permissionList); | |||
| // } | |||
| MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| info.setPassword("保密"); | |||
| // System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); | |||
| MallUserRole ur = new MallUserRole(); | |||
| ur.setUid(info.getId()); | |||
| PageInfo<MallUserRole> page = mallUserRoleService.listAsPage(ur, 1, 1); | |||
| if (page.getSize() > 0) { | |||
| Long roleId = page.getList().get(0).getRoleId(); | |||
| MallRolePermission p = new MallRolePermission(); | |||
| p.setRoleId(roleId); | |||
| p.setTenantId(info.getTenantId()); | |||
| PageInfo<MallRolePermission> listAsPage = mallRolePermissionService.listAsPage(p, 1, 100); | |||
| String menus = ""; | |||
| for (MallRolePermission rp : listAsPage.getList()) { | |||
| menus += rp.getPermissionId() + ","; | |||
| } | |||
| if (menus.length() > 0) { | |||
| menus = menus.substring(0, menus.length() - 1); | |||
| } | |||
| info.setMenus(menus); | |||
| } | |||
| data.data = info; | |||
| } catch (Exception e) { | |||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||
| } | |||
| return data; | |||
| } | |||
| @ApiOperation("登出") | |||
| @GetMapping("/logout") | |||
| public ResultData login() { | |||
| public ResultData logout() { | |||
| logger.debug("[" + getIpAddr() + "] HomeController::logout"); | |||
| ResultData data = new ResultData(); | |||
| SecurityUtils.getSubject().logout(); | |||
| return data; | |||
| @@ -137,6 +209,7 @@ public class HomeController { | |||
| @ApiOperation("获取后端版本号") | |||
| @GetMapping("/version") | |||
| public ResultData version() { | |||
| logger.debug("[" + getIpAddr() + "] HomeController::version"); | |||
| return new ResultData(version); | |||
| } | |||
| } | |||
| @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| */ | |||
| @RestController | |||
| @RequestMapping("permission") | |||
| public class MallPermissionController { | |||
| public class MallPermissionController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @@ -29,6 +29,7 @@ public class MallPermissionController { | |||
| @GetMapping("alllist") | |||
| public ResultData alllist(String ava) { | |||
| logger.debug("[" + getIpAddr() + "] MallPermissionController::alllist"); | |||
| MallPermission record = new MallPermission(); | |||
| record.setAvailable(ava); | |||
| PageInfo<MallPermission> permissions = mallPermissionService.listAsPage(record, 1, 10000); | |||
| @@ -37,6 +38,7 @@ public class MallPermissionController { | |||
| @PostMapping("add") | |||
| public ResultData createPermission(MallPermission mallPermission) { | |||
| logger.debug("[" + getIpAddr() + "] MallPermissionController::createPermission"); | |||
| Assert.notNull(mallPermission.getName(), "用户名不能为空"); | |||
| mallPermissionService.saveOrUpdate(mallPermission); | |||
| return new ResultData(mallPermission.getId()); | |||
| @@ -44,18 +46,21 @@ public class MallPermissionController { | |||
| @PostMapping("update") | |||
| public ResultData updatePermission(MallPermission sysPermission) { | |||
| logger.debug("[" + getIpAddr() + "] MallPermissionController::updatePermission"); | |||
| mallPermissionService.saveOrUpdate(sysPermission); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/del") | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] MallPermissionController::delete"); | |||
| mallPermissionService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] MallPermissionController::findById"); | |||
| mallPermissionService.getById(id); | |||
| return new ResultData(Result.SUCCESS, "成功", null); | |||
| } | |||
| @@ -12,6 +12,8 @@ import com.iformall.service.MallRolePermissionService; | |||
| import com.iformall.service.MallRoleService; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -40,7 +42,11 @@ public class MallRoleController extends BaseController { | |||
| private MallUserInfoService mallUserInfoService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] MallRoleController::list"); | |||
| String tenantId = getTenantId(); | |||
| sysRole.setTenantId(tenantId); | |||
| final PageInfo<MallRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | |||
| @@ -64,6 +70,7 @@ public class MallRoleController extends BaseController { | |||
| @PostMapping("saveOrUpdate") | |||
| public ResultData saveOrUpdate(@RequestBody MallRole sysRole) { | |||
| logger.debug("[" + getIpAddr() + "] MallRoleController::saveOrUpdate"); | |||
| MallUserInfo currentUser = getUser(); | |||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能保存角色"); | |||
| @@ -89,6 +96,7 @@ public class MallRoleController extends BaseController { | |||
| @PostMapping("add") | |||
| public ResultData add(MallRole sysRole) { | |||
| logger.debug("[" + getIpAddr() + "] MallRoleController::add"); | |||
| MallUserInfo currentUser = getUser(); | |||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能添加角色"); | |||
| @@ -101,6 +109,7 @@ public class MallRoleController extends BaseController { | |||
| @PostMapping("update") | |||
| public ResultData update(MallRole sysRole) { | |||
| logger.debug("[" + getIpAddr() + "] MallRoleController::update"); | |||
| MallUserInfo currentUser = getUser(); | |||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能更新角色"); | |||
| @@ -116,6 +125,7 @@ public class MallRoleController extends BaseController { | |||
| @PostMapping("/del") | |||
| public ResultData delete(@RequestBody MallRole sysRole) { | |||
| logger.debug("[" + getIpAddr() + "] MallRoleController::delete"); | |||
| MallUserInfo currentUser = getUser(); | |||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能删除角色"); | |||
| @@ -59,7 +59,11 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "用户分页接口", response = String.class) | |||
| @GetMapping("lists") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData listAsPage(MallUserInfo userInfo, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::listAsPage"); | |||
| userInfo.setTenantId(getTenantId()); | |||
| userInfo.setSortColumns(MallUserInfo.Field.Id_DESC); | |||
| final PageInfo<MallUserInfo> page = userInfoService.listAsPage(userInfo, pageNum, pageSize); | |||
| @@ -82,6 +86,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "用户详情接口", response = String.class) | |||
| @GetMapping("detail") | |||
| public ResultData detail(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::detail"); | |||
| final MallUserInfo user = userInfoService.getById(id); | |||
| return new ResultData(user); | |||
| } | |||
| @@ -89,6 +94,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "创建用户接口", response = String.class) | |||
| @PostMapping("add") | |||
| public ResultData createUser(@RequestBody MallUserInfo userInfo) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::createUser"); | |||
| MallUserInfo currentUser = getUser(); | |||
| if(currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能添加用户"); | |||
| @@ -119,6 +125,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "修改用户接口", response = String.class) | |||
| @PostMapping("update") | |||
| public ResultData updateUser(@RequestBody MallUserInfo userInfo) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::updateUser"); | |||
| MallUserInfo currentUser = getUser(); | |||
| // 只有超管和自己能更新信息 | |||
| if (!(currentUser.getId().equals(userInfo.getId()) || | |||
| @@ -142,7 +149,10 @@ public class MallUserInfoController extends BaseController { | |||
| PasswordHelper passwordHelper = new PasswordHelper(); | |||
| passwordHelper.encryptPassword(userInfo); | |||
| } | |||
| userInfo.setIsAdmin(null); | |||
| if (!currentUser.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| // 只有超级管理员才能设置超级管理员 | |||
| userInfo.setIsAdmin(null); | |||
| } | |||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode()) && | |||
| currentUser.getId().equals(userInfo.getId())) { | |||
| @@ -177,6 +187,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "删除用户接口", response = String.class) | |||
| @PostMapping("/del") | |||
| public ResultData deleteUser(@RequestBody MallUserInfo userInfo) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::deleteUser"); | |||
| MallUserInfo currentUser = getUser(); | |||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能删除用户"); | |||
| @@ -199,6 +210,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "起停用户接口", response = String.class) | |||
| @GetMapping("status") | |||
| public ResultData modifyStatus(Long userId, Integer status) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::modifyStatus"); | |||
| MallUserInfo currentUser = getUser(); | |||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有超级管理员才能删除用户"); | |||
| @@ -227,6 +239,7 @@ public class MallUserInfoController extends BaseController { | |||
| @GetMapping("hasButtonPermission") | |||
| public ResultData hasButtonPermission(String permissions) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::hasButtonPermission"); | |||
| MallUserInfo info = getUser(); | |||
| info.setPassword("保密"); | |||
| Map<String, Boolean> map = new HashMap<>(); | |||
| @@ -247,6 +260,7 @@ public class MallUserInfoController extends BaseController { | |||
| @GetMapping("getUser") | |||
| public ResultData getUserInfo() { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::getUserInfo"); | |||
| MallUserInfo info = getUser(); | |||
| info.setPassword("保密"); | |||
| if (info.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { // isAdmin | |||
| @@ -288,7 +302,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiImplicitParam(name = "userName", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景(1:登录)", dataType = "Integer", paramType = "query", required = true)}) | |||
| public ResultData sendvalidationcode(String userName, Integer type) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::sendvalidationcode"); | |||
| MallUserInfo userQ = new MallUserInfo(); | |||
| userQ.setUsername(userName); | |||
| @@ -318,6 +332,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "修改密码", notes = "{\"userName\",\"string\",\"code\",\"string\",\"pwd\",\"string\"}") | |||
| @PostMapping("/updatepwd") | |||
| public ResultData updatepwd(@RequestBody Map<String, String> params) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::updatepwd"); | |||
| // String phone,String code,String pwd | |||
| String userName = params.get("userName"); | |||
| String code = params.get("code"); | |||
| @@ -4,6 +4,8 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.service.MarkingDataReportService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -28,36 +30,51 @@ public class MarkingDataReportController extends BaseController { | |||
| @ApiOperation("查询券数据") | |||
| @GetMapping("/couponData") | |||
| public ResultData findCouponData() { | |||
| return new ResultData(markingDataReportService.getCouponDate(getTenantId())); | |||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::findCouponData"); | |||
| return new ResultData(markingDataReportService.getCouponData(getTenantId())); | |||
| } | |||
| @ApiOperation("查询券数据列表") | |||
| @GetMapping("/couponDataList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(markingDataReportService.getCouponDateList(getTenantId(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::findCouponDataList"); | |||
| return new ResultData(markingDataReportService.getCouponDataList(getTenantId(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("查询场景投放券数据") | |||
| @GetMapping("/sceneData") | |||
| public ResultData findSceneData() { | |||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::findSceneData"); | |||
| return new ResultData(markingDataReportService.getSceneData(getTenantId())); | |||
| } | |||
| @ApiOperation("查询场景营销数据列表") | |||
| @GetMapping("/sceneDataList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::findSceneDataList"); | |||
| return new ResultData(markingDataReportService.getSceneDataList(getTenantId(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("查询触达用户数数据") | |||
| @GetMapping("/touchUsersData") | |||
| public ResultData touchUsersData() { | |||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::touchUsersData"); | |||
| return new ResultData(markingDataReportService.getTouchUsersReportData(getTenantId())); | |||
| } | |||
| @ApiOperation("查询触达用户数数据列表") | |||
| @GetMapping("/touchUsersDataList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] MarkingDataReportController::touchUsersDataList"); | |||
| return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantId(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| } | |||
| @@ -22,6 +22,7 @@ public class PushLimitController extends BaseController { | |||
| @ApiOperation("疲劳度配置") | |||
| @GetMapping("setting") | |||
| public ResultData list() { | |||
| logger.debug("[" + getIpAddr() + "] PushLimitController::list"); | |||
| PushLimit pushLimit = pushLimitService.getPushLimit(getTenantId()); | |||
| return new ResultData(pushLimit); | |||
| } | |||
| @@ -29,6 +30,7 @@ public class PushLimitController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody PushLimit pushLimit) { | |||
| logger.debug("[" + getIpAddr() + "] PushLimitController::update"); | |||
| pushLimit.setTenantId(getTenantId()); | |||
| pushLimitService.saveOrUpdate(pushLimit); | |||
| return new ResultData(); | |||
| @@ -41,22 +41,16 @@ public class UploadController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private AwsProperty awsProperty; | |||
| /* | |||
| @Value("${fileUpload.path}") | |||
| private String filePath; | |||
| @Value("${fileUpload.server}") | |||
| private String server; | |||
| @Autowired | |||
| private AwsProperty awsProperty; | |||
| /** | |||
| * 上传文件 | |||
| * | |||
| * @param multiReq | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/fileUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("上传文件") | |||
| public ResultData fileUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| @@ -108,6 +102,7 @@ public class UploadController extends BaseController { | |||
| } | |||
| return data; | |||
| } | |||
| */ | |||
| /** | |||
| * 上传文件 | |||
| @@ -119,6 +114,7 @@ public class UploadController extends BaseController { | |||
| @PostMapping(value = "/awsFileUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("上传文件") | |||
| public ResultData awsfileUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| logger.debug("[" + getIpAddr() + "] UploadController::awsfileUpload"); | |||
| ResultData data = new ResultData(); | |||
| @@ -27,6 +27,7 @@ public class WxAdminLogController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxAdminLog wxAdminLog, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxAdminLogController::list"); | |||
| if (null == wxAdminLog) wxAdminLog = new WxAdminLog(); | |||
| final PageInfo<WxAdminLog> page = wxAdminLogService.listAsPage(wxAdminLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxAdminLogController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxAdminLog wxAdminLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxAdminLogController::add"); | |||
| //Assert.notNull(wxAdminLog.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxAdminLogService.saveOrUpdate(wxAdminLog); | |||
| @@ -44,6 +46,7 @@ public class WxAdminLogController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxAdminLog wxAdminLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxAdminLogController::update"); | |||
| String tenantId = getTenantId(); | |||
| wxAdminLog.setTenantId(tenantId); | |||
| wxAdminLogService.saveOrUpdate(wxAdminLog); | |||
| @@ -54,6 +57,7 @@ public class WxAdminLogController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxAdminLogController::delete"); | |||
| wxAdminLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -62,12 +66,14 @@ public class WxAdminLogController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxAdminLogController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxAdminLogService.getById(id)); | |||
| } | |||
| @ApiOperation("PV计数") | |||
| @PostMapping("pvlog") | |||
| public ResultData pvLog(@RequestBody WxAdminLog wxAdminLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxAdminLogController::pvLog"); | |||
| String tenantId = getTenantId(); | |||
| wxAdminLog.setTenantId(tenantId); | |||
| wxAdminLogService.saveLogCount(wxAdminLog); | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| @@ -8,11 +9,16 @@ import com.iformall.service.WxAppinfoService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxAppinfo") | |||
| public class WxAppinfoController extends BaseController { | |||
| @@ -27,6 +33,7 @@ public class WxAppinfoController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxAppinfo wxAppinfo, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::list"); | |||
| if (null == wxAppinfo) wxAppinfo = new WxAppinfo(); | |||
| final PageInfo<WxAppinfo> page = wxAppinfoService.listAsPage(wxAppinfo, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +42,7 @@ public class WxAppinfoController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxAppinfo wxAppinfo) { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::add"); | |||
| //Assert.notNull(wxAppinfo.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxAppinfoService.saveOrUpdate(wxAppinfo); | |||
| @@ -44,6 +52,7 @@ public class WxAppinfoController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxAppinfo wxAppinfo) { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::update"); | |||
| wxAppinfoService.saveOrUpdate(wxAppinfo); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +61,7 @@ public class WxAppinfoController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::delete"); | |||
| wxAppinfoService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,8 +70,58 @@ public class WxAppinfoController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxAppinfoService.getById(id)); | |||
| } | |||
| @ApiOperation("更新AccessToken, 无限制二维码生成需要更新token") | |||
| @GetMapping("/accessTokenUpdate") | |||
| public ResultData tokenUpdate() { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::tokenUpdate"); | |||
| try { | |||
| wxAppinfoService.tokenUpdate(getTenantId()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation(value = "下载二维码", notes = "参数{\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") | |||
| @PostMapping("/downQrCode") | |||
| public ResultData downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> params) { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::downQrCode"); | |||
| String pageUrl = (String) params.get("pageUrl"); | |||
| String sceneParam = (String) params.get("sceneParam"); | |||
| int type = 0; | |||
| try { | |||
| type = (int) params.get("type"); | |||
| } catch (Exception e) { | |||
| type = 0; | |||
| } | |||
| int withText = 0; | |||
| try { | |||
| withText = (int) params.get("withText"); | |||
| } catch (Exception e) { | |||
| withText = 0; | |||
| } | |||
| String text1 = (String) params.get("text1"); | |||
| String text2 = (String) params.get("text2"); | |||
| if (StringUtils.isBlank(pageUrl)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "pageUrl不能为空"); | |||
| } | |||
| try { | |||
| wxAppinfoService.exportQrcode(request, response, | |||
| getTenantId(), type, pageUrl, sceneParam, | |||
| withText, text1, text2); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxBLogController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBLog wxBLog, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBLogController::list"); | |||
| if (null == wxBLog) wxBLog = new WxBLog(); | |||
| final PageInfo<WxBLog> page = wxBLogService.listAsPage(wxBLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxBLogController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBLog wxBLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxBLogController::add"); | |||
| //Assert.notNull(wxBLog.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxBLogService.saveOrUpdate(wxBLog); | |||
| @@ -44,6 +46,7 @@ public class WxBLogController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBLog wxBLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxBLogController::update"); | |||
| wxBLogService.saveOrUpdate(wxBLog); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxBLogController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBLogController::delete"); | |||
| wxBLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxBLogController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBLogController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBLogService.getById(id)); | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.service.WxBillAllService; | |||
| import com.iformall.service.WxPropertyContractService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillAll") | |||
| public class WxBillAllController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillAllService wxBillAllService; | |||
| private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::list"); | |||
| if (null == wxBillAll){ | |||
| wxBillAll = new WxBillAll(); | |||
| } | |||
| wxBillAll.setTenantId(getTenantId()); | |||
| Map<String, Object> result = wxBillAllService.listAsPage(wxBillAll, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| } | |||
| @@ -0,0 +1,79 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDaily; | |||
| import com.iformall.service.WxBillDailyService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillDaily") | |||
| public class WxBillDailyController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillDailyService wxBillDailyService; | |||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBillDaily wxBillDaily,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::list"); | |||
| if (null == wxBillDaily) { | |||
| wxBillDaily = new WxBillDaily(); | |||
| } | |||
| wxBillDaily.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String,Object>> page = wxBillDailyService.listAsPage(wxBillDaily, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillDaily wxBillDaily) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::add"); | |||
| wxBillDaily.setTenantId(getTenantId()); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::update"); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::delete"); | |||
| wxBillDailyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillDailyService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::updatePaid"); | |||
| return wxBillDailyService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,80 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillDeposit; | |||
| import com.iformall.service.WxBillDepositService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillDeposit") | |||
| public class WxBillDepositController extends BaseController { | |||
| @Autowired | |||
| private WxBillDepositService wxBillDepositService; | |||
| private Logger logger = LoggerFactory.getLogger(WxBillDepositController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBillDeposit wxBillDeposit, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::list"); | |||
| if (null == wxBillDeposit) { | |||
| wxBillDeposit = new WxBillDeposit(); | |||
| } | |||
| wxBillDeposit.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String, Object>> page = wxBillDepositService.listAsPage(wxBillDeposit, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillDeposit wxBillDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::add"); | |||
| wxBillDeposit.setTenantId(getTenantId()); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillDeposit wxBillDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::update"); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::delete"); | |||
| wxBillDepositService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillDepositService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::updatePaid"); | |||
| return wxBillDepositService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,79 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillOther; | |||
| import com.iformall.service.WxBillOtherService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillOther") | |||
| public class WxBillOtherController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillOtherService wxBillOtherService; | |||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBillOther wxBillOther,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::list"); | |||
| if (null == wxBillOther) { | |||
| wxBillOther = new WxBillOther(); | |||
| } | |||
| wxBillOther.setTenantId(getTenantId()); | |||
| final PageInfo<Map<String,Object>> page = wxBillOtherService.listAsPage(wxBillOther, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillOther wxBillOther) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::add"); | |||
| wxBillOther.setTenantId(getTenantId()); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillOther wxBillOther) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::update"); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::delete"); | |||
| wxBillOtherService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillOtherService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::updatePaid"); | |||
| return wxBillOtherService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,80 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillProperty; | |||
| import com.iformall.service.WxBillPropertyService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillProperty") | |||
| public class WxBillPropertyController extends BaseController { | |||
| @Autowired | |||
| private WxBillPropertyService wxBillPropertyService; | |||
| private Logger logger = LoggerFactory.getLogger(WxBillPropertyController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBillProperty wxBillProperty, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::list"); | |||
| if (null == wxBillProperty) { | |||
| wxBillProperty = new WxBillProperty(); | |||
| } | |||
| wxBillProperty.setTenantId(getTenantId()); | |||
| PageInfo<Map<String, Object>> result = wxBillPropertyService.listAsPage(wxBillProperty, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillProperty wxBillProperty) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::add"); | |||
| wxBillProperty.setTenantId(getTenantId()); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillProperty wxBillProperty) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::update"); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::delete"); | |||
| wxBillPropertyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillPropertyService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::updatePaid"); | |||
| return wxBillPropertyService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,81 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.service.WxBillPropertyDepositService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillPropertyDeposit") | |||
| public class WxBillPropertyDepositController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillPropertyDepositService wxBillPropertyDepositService; | |||
| private Logger logger = LoggerFactory.getLogger(WxBillPropertyDepositController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBillPropertyDeposit wxBillPropertyDeposit, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::list"); | |||
| if (null == wxBillPropertyDeposit) { | |||
| wxBillPropertyDeposit = new WxBillPropertyDeposit(); | |||
| } | |||
| wxBillPropertyDeposit.setTenantId(getTenantId()); | |||
| PageInfo<Map<String, Object>> result = wxBillPropertyDepositService.listAsPage(wxBillPropertyDeposit, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::add"); | |||
| wxBillPropertyDeposit.setTenantId(getTenantId()); | |||
| wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::update"); | |||
| wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::delete"); | |||
| wxBillPropertyDepositService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillPropertyDepositService.getById(id)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::updatePaid"); | |||
| return wxBillPropertyDepositService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxBillRent") | |||
| public class WxBillRentController extends BaseController { | |||
| @@ -27,7 +30,10 @@ public class WxBillRentController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBillRent wxBillRent, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillRent) wxBillRent = new WxBillRent(); | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::list"); | |||
| if (null == wxBillRent) { | |||
| wxBillRent = new WxBillRent(); | |||
| } | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| wxBillRent.setSortColumns(WxBillRent.Field.Id_DESC); | |||
| final PageInfo<Map<String, Object>> page = wxBillRentService.listAsPage(wxBillRent, pageNum, pageSize); | |||
| @@ -36,22 +42,21 @@ public class WxBillRentController extends BaseController { | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBillRent wxBillRent) { | |||
| //Assert.notNull(wxBillRent.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::add"); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return new ResultData(ResultData.SUCCESS, "操作成功"); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillRent wxBillRent) { | |||
| wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return new ResultData(ResultData.SUCCESS, "操作成功"); | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::update"); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::delete"); | |||
| wxBillRentService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -59,8 +64,22 @@ public class WxBillRentController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.getById(id)); | |||
| } | |||
| @GetMapping("/findByMerchantId") | |||
| @ApiImplicitParam(name = "merchantId", value = "merchantId", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findByMerchantId(Long merchantId) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::findByMerchantId"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.findByMerchantId(merchantId)); | |||
| } | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData updatePaid(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::updatePaid"); | |||
| return wxBillRentService.updatePaid(id); | |||
| } | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxBusinessController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBusiness wxBusiness, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::list"); | |||
| if (null == wxBusiness) wxBusiness = new WxBusiness(); | |||
| final PageInfo<WxBusiness> page = wxBusinessService.listAsPage(wxBusiness, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxBusinessController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBusiness wxBusiness) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::add"); | |||
| //Assert.notNull(wxBusiness.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxBusinessService.saveOrUpdate(wxBusiness); | |||
| @@ -44,6 +46,7 @@ public class WxBusinessController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBusiness wxBusiness) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::update"); | |||
| wxBusinessService.saveOrUpdate(wxBusiness); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxBusinessController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::delete"); | |||
| wxBusinessService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxBusinessController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBusinessService.getById(id)); | |||
| } | |||
| @@ -29,6 +29,7 @@ public class WxCLogController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCLog wxCLog,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCLogController::list"); | |||
| if (null == wxCLog) wxCLog = new WxCLog(); | |||
| final PageInfo<WxCLog> page = wxCLogService.listAsPage(wxCLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -37,6 +38,7 @@ public class WxCLogController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCLog wxCLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxCLogController::add"); | |||
| //Assert.notNull(wxCLog.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCLogService.saveOrUpdate(wxCLog); | |||
| @@ -46,6 +48,7 @@ public class WxCLogController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCLog wxCLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxCLogController::update"); | |||
| wxCLogService.saveOrUpdate(wxCLog); | |||
| return new ResultData(); | |||
| } | |||
| @@ -54,6 +57,7 @@ public class WxCLogController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCLogController::delete"); | |||
| wxCLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -62,7 +66,8 @@ public class WxCLogController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCLogService.getById(id)); | |||
| logger.debug("[" + getIpAddr() + "] WxCLogController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCLogService.getById(id)); | |||
| } | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.Api; | |||
| @@ -25,6 +26,7 @@ import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.stream.Collectors; | |||
| @RestController | |||
| @RequestMapping("wxCUserBasicInfo") | |||
| @@ -39,10 +41,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| private WxCUserCarService wxCUserCarService; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @@ -50,12 +49,59 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| @Autowired | |||
| WxLevelConfigService wxLevelConfigService; | |||
| private void setUserInfoLevel(WxCUserBasicInfo info) { | |||
| if (info.getPoins() == null || info.getPoins() == 0) { | |||
| info.setLevel("无"); | |||
| } else { | |||
| info.setLevel("无"); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(info.getTenantId()); | |||
| for(WxLevelConfig levelConfig: levelList) { | |||
| if (info.getPoins() >= levelConfig.getPoints()) { | |||
| info.setLevel(levelConfig.getLevel()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| private void setUserInfoTag(WxCUserBasicInfo info) { | |||
| if (info.getTagId() != null) { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||
| info.setTagsList(wxCUserTagsService.findTagList(getTenantId(),ids)); | |||
| } | |||
| } | |||
| } | |||
| private void setUserInfoCar(WxCUserBasicInfo info) { | |||
| WxCUserCar wxCUserCar = new WxCUserCar(); | |||
| wxCUserCar.setCUserId(info.getId()); | |||
| List<WxCUserCar> list = wxCUserCarService.getList(wxCUserCar); | |||
| if (list.size() > 0) { | |||
| info.setCarList(list.stream().map(p -> p.getCarNumber()).collect(Collectors.toList())); | |||
| } | |||
| } | |||
| private void setUserInfoCarCount(WxCUserBasicInfo info) { | |||
| WxCUserCar wxCUserCar = new WxCUserCar(); | |||
| wxCUserCar.setCUserId(info.getId()); | |||
| info.setCarCount(wxCUserCarService.countUserCar(wxCUserCar)); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCUserBasicInfo wxCUserBasicInfo, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::list"); | |||
| if (null == wxCUserBasicInfo) { | |||
| wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| } else { | |||
| @@ -70,35 +116,16 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| wxCUserBasicInfo.setSortColumns(WxCUserBasicInfo.Field.Id_DESC); | |||
| PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| private void createUserBasicInfo(WxCUser wxCUser) { | |||
| String phone = wxCUser.getPhone(); | |||
| if (phone != null && phone.contains("*")) { | |||
| phone = wxCUser.getVerifyCodePhone(); | |||
| if (page.getSize() > 0) { | |||
| for (WxCUserBasicInfo info : page.getList()) { | |||
| setUserInfoLevel(info); | |||
| setUserInfoCarCount(info); | |||
| } | |||
| } | |||
| if (StringUtils.isBlank(phone)) | |||
| return; | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(wxCUser.getId()); | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| wxCUserBasicInfo.setTenantId(wxCUser.getTenantId()); | |||
| wxCUserBasicInfo.setNickName(wxCUser.getNickName()); | |||
| wxCUserBasicInfoService.save(wxCUserBasicInfo); | |||
| return new ResultData(page); | |||
| } | |||
| // @ApiOperation("新增接口") | |||
| // @PostMapping("add") | |||
| // public ResultData add(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { | |||
| // //Assert.notNull(wxCUserBasicInfo.getName(), "角色名不能为空"); | |||
| // //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| // wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); | |||
| // return new ResultData(); | |||
| // } | |||
| private int checkUniquePhone(String phone, String tenantId) { | |||
| WxCUserBasicInfo baseInfoQ = new WxCUserBasicInfo(); | |||
| baseInfoQ.setPhone(phone); | |||
| @@ -109,6 +136,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::update"); | |||
| MallUserInfo currentUser = getUser(); | |||
| WxCUserBasicInfo oldInfo = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); | |||
| if (!oldInfo.getPhone().equals(wxCUserBasicInfo.getPhone())) { | |||
| @@ -136,6 +164,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| wxCUserBasicInfo.setTagId(record.getId()); | |||
| } | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT,wxCUserBasicInfo); | |||
| return new ResultData(); | |||
| } | |||
| @@ -143,6 +172,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::delete"); | |||
| wxCUserBasicInfoService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -151,52 +181,23 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::findById"); | |||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); | |||
| if (info != null) { | |||
| if (info.getTagId() != null) { | |||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||
| if (!ids.isEmpty()) { | |||
| WxTags wxTags = new WxTags(); | |||
| wxTags.setIds(ids); | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||
| String tagNames = ""; | |||
| String tagIds = ""; | |||
| List<Long> tagIdList = new ArrayList<>(); | |||
| for (WxTags wt : page.getList()) { | |||
| tagNames += wt.getName() + "/"; | |||
| tagIds += wt.getId() + ","; | |||
| tagIdList.add(wt.getId()); | |||
| } | |||
| if (StringUtils.isNotBlank(tagNames)) { | |||
| info.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||
| } | |||
| if (StringUtils.isNoneBlank(tagIds)) { | |||
| info.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||
| } | |||
| long count = wxCUserTagsService.findCountByTag(getTenantId(), tagIdList); | |||
| info.setCount(count); | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| info = new WxCUserBasicInfo(); | |||
| info.setId(id); | |||
| WxCUser user = wxCUserService.getById(id); | |||
| if (user != null) { | |||
| info.setTenantId(user.getTenantId()); | |||
| info.setPhone(user.getPhone()); | |||
| info.setSex(user.getGender()); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", info); | |||
| if (info == null) | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| setUserInfoTag(info); | |||
| setUserInfoLevel(info); | |||
| setUserInfoCar(info); | |||
| return new ResultData(info); | |||
| } | |||
| @ApiOperation("根据userId查询交易记录接口") | |||
| @GetMapping("/findOrderCouponByUserId") | |||
| @ApiImplicitParam(name = "userId", value = "userId", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findOrderCouponByUserId(Long userId, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::findOrderCouponByUserId"); | |||
| WxCouponOrder corder = new WxCouponOrder(); | |||
| corder.setCUserId(userId); | |||
| corder.setTenantId(getTenantId()); | |||
| @@ -214,6 +215,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @RequestMapping("/exportData") | |||
| public void exportData(HttpServletRequest request, HttpServletResponse response){ | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::exportData"); | |||
| wxCUserBasicInfoService.exportData(request,response,getTenantId()); | |||
| @@ -221,6 +223,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @RequestMapping("/exportTemplate") | |||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response){ | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::exportTemplate"); | |||
| wxCUserBasicInfoService.exportTemplate(request,response,getTenantId()); | |||
| @@ -229,6 +232,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @Transactional | |||
| @RequestMapping("/importTemplate") | |||
| public ResultData importTemplate(@RequestParam("file") MultipartFile file){ | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::importTemplate"); | |||
| if (file.isEmpty()) { | |||
| throw new MallinkException(500,"上传文件不能为空"); | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxCUserCarController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCUserCar wxCUserCar, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserCarController::list"); | |||
| if (null == wxCUserCar) wxCUserCar = new WxCUserCar(); | |||
| final PageInfo<WxCUserCar> page = wxCUserCarService.listAsPage(wxCUserCar, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxCUserCarController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCUserCar wxCUserCar) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserCarController::add"); | |||
| //Assert.notNull(wxCUserCar.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||
| @@ -44,6 +46,7 @@ public class WxCUserCarController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCUserCar wxCUserCar) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserCarController::update"); | |||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxCUserCarController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserCarController::delete"); | |||
| wxCUserCarService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxCUserCarController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserCarController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCUserCarService.getById(id)); | |||
| } | |||
| @@ -29,6 +29,7 @@ public class WxCUserController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCUser wxCUser,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserController::list"); | |||
| if (null == wxCUser) wxCUser = new WxCUser(); | |||
| final PageInfo<WxCUser> page = wxCUserService.listAsPage(wxCUser, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -37,6 +38,7 @@ public class WxCUserController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCUser wxCUser) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserController::add"); | |||
| //Assert.notNull(wxCUser.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCUserService.saveOrUpdate(wxCUser); | |||
| @@ -46,6 +48,7 @@ public class WxCUserController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCUser wxCUser) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserController::update"); | |||
| wxCUserService.saveOrUpdate(wxCUser); | |||
| return new ResultData(); | |||
| } | |||
| @@ -54,6 +57,7 @@ public class WxCUserController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserController::delete"); | |||
| wxCUserService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -62,7 +66,8 @@ public class WxCUserController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserService.getById(id)); | |||
| logger.debug("[" + getIpAddr() + "] WxCUserController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserService.getById(id)); | |||
| } | |||
| @@ -31,268 +31,271 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxCUserData") | |||
| @Api(description="会员首页报表数据") | |||
| @Api(description = "会员首页报表数据") | |||
| public class WxCUserDataController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxUserVisitService wxUserVisitService; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @GetMapping("findUserCountData") | |||
| @ApiOperation("查询用户数量接口") | |||
| public ResultData findUserCountData() { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| long allCount = wxCUserService.findCount(dto);//总数 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| Date today = c.getTime(); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| long todayCount=0; | |||
| long yesterdayCount =0; | |||
| long dayOfWeekCount=0; | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//周会员数 | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周会员数 | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxUserVisitService wxUserVisitService; | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| for(int i=29,sortNum=0;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count= wxCUserService.findCount(dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| @GetMapping("findUserCountData") | |||
| @ApiOperation("查询用户数量接口") | |||
| public ResultData findUserCountData() { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserCountData"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| long allCount = wxCUserService.findCount(dto);//总数 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| Date today = c.getTime(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); | |||
| vo.setSortNum(sortNum++); | |||
| vo.setCount(count); | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setName(vo.getName()); | |||
| vow.setCount(vo.getCount()); | |||
| long todayCount = 0; | |||
| long yesterdayCount = 0; | |||
| long dayOfWeekCount = 0; | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//周会员数 | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周会员数 | |||
| if (i == 1) { | |||
| yesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 0) { | |||
| todayCount = vow.getCount(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getCount(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| } | |||
| for (int i = 29, sortNum = 0; i >= 0; i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count = wxCUserService.findCount(dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage ="--"; | |||
| if(yesterdayCount>0) { | |||
| Long count =todayCount-yesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage ="--"; | |||
| if(dayOfWeekCount>0) { | |||
| Long count =todayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("allCount", allCount);//会员总数 | |||
| map.put("todayCount", todayCount);//今日新增会员数 | |||
| map.put("weekVos", weekVos);//月用户增加数列表 | |||
| map.put("monthVos", monthVos);//月用户增加数列表 | |||
| map.put("dayPercentage",dayPercentage);//日环比 | |||
| map.put("weekPercentage",weekPercentage); //周同比 | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("查询用户活跃量") | |||
| @GetMapping("findUserVisitData") | |||
| public ResultData findUserVisitData() { | |||
| HashMap<String, Object> params =new HashMap<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| Date endTime = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| Date startTime = c.getTime(); | |||
| params.put("startTime", startTime); | |||
| params.put("endTime", endTime); | |||
| params.put("tenantId", getTenantId()); | |||
| List<TouchUsersReportVo> list = wxUserVisitService.touchUsersReportList(params); | |||
| Map<String,TouchUsersReportVo> dateMap = new HashMap<>(); | |||
| for(TouchUsersReportVo vo :list) { | |||
| dateMap.put(vo.getxTime(), vo); | |||
| } | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//每周uv | |||
| List<UserStructureVo> monthVos =new ArrayList<>();//每月uv | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); | |||
| vo.setSortNum(sortNum++); | |||
| vo.setCount(count); | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setName(vo.getName()); | |||
| vow.setCount(vo.getCount()); | |||
| long yesterdayCount =0;//昨天活跃数 | |||
| long beforeYesterdayCount=0;//前天活跃数 | |||
| long thisMonthCount=0;//月总数 | |||
| long dayOfWeekCount=0;//上周周x数 | |||
| for(int i=29,sortNum=0;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| vo.setSortNum(sortNum++); | |||
| if(dateMap.get(dayStr)!=null) { | |||
| TouchUsersReportVo rv = dateMap.get(dayStr); | |||
| Long l = new Long((long) rv.getUv()); | |||
| vo.setCount(l); | |||
| }else { | |||
| vo.setCount(0); | |||
| } | |||
| if (i == 1) { | |||
| yesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 0) { | |||
| todayCount = vow.getCount(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getCount(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| } | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setName(vo.getName()); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setCount(vo.getCount()); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage = "--"; | |||
| if (yesterdayCount > 0) { | |||
| Long count = todayCount - yesterdayCount; | |||
| dayPercentage = nf.format(count.doubleValue() / new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage = "--"; | |||
| if (dayOfWeekCount > 0) { | |||
| Long count = todayCount - dayOfWeekCount; | |||
| weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String, Object> map = new HashMap<>(); | |||
| map.put("allCount", allCount);//会员总数 | |||
| map.put("todayCount", todayCount);//今日新增会员数 | |||
| map.put("weekVos", weekVos);//月用户增加数列表 | |||
| map.put("monthVos", monthVos);//月用户增加数列表 | |||
| map.put("dayPercentage", dayPercentage);//日环比 | |||
| map.put("weekPercentage", weekPercentage); //周同比 | |||
| return new ResultData(map); | |||
| } | |||
| if (i == 0) { | |||
| yesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 1) { | |||
| beforeYesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getCount(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| @ApiOperation("查询用户活跃量") | |||
| @GetMapping("findUserVisitData") | |||
| public ResultData findUserVisitData() { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserVisitData"); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| Date endTime = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| Date startTime = c.getTime(); | |||
| params.put("startTime", startTime); | |||
| params.put("endTime", endTime); | |||
| params.put("tenantId", getTenantId()); | |||
| List<TouchUsersReportVo> list = wxUserVisitService.touchUsersReportList(params); | |||
| Map<String, TouchUsersReportVo> dateMap = new HashMap<>(); | |||
| for (TouchUsersReportVo vo : list) { | |||
| dateMap.put(vo.getxTime(), vo); | |||
| } | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//每周uv | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//每月uv | |||
| } | |||
| monthVos.add(vo); | |||
| thisMonthCount+=vo.getCount(); | |||
| } | |||
| long yesterdayCount = 0;//昨天活跃数 | |||
| long beforeYesterdayCount = 0;//前天活跃数 | |||
| long thisMonthCount = 0;//月总数 | |||
| long dayOfWeekCount = 0;//上周周x数 | |||
| for (int i = 29, sortNum = 0; i >= 0; i--) { | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| vo.setSortNum(sortNum++); | |||
| if (dateMap.get(dayStr) != null) { | |||
| TouchUsersReportVo rv = dateMap.get(dayStr); | |||
| Long l = new Long((long) rv.getUv()); | |||
| vo.setCount(l); | |||
| } else { | |||
| vo.setCount(0); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage ="--"; | |||
| if(beforeYesterdayCount>0) { | |||
| Long count =yesterdayCount-beforeYesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(beforeYesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage ="--"; | |||
| if(dayOfWeekCount>0) { | |||
| Long count =yesterdayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String,Object> mapVo =new HashMap<>(); | |||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | |||
| mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 | |||
| mapVo.put("weekVos", weekVos);//周活跃数列表 | |||
| mapVo.put("monthVos", monthVos);//月活跃数列表 | |||
| mapVo.put("dayPercentage",dayPercentage);//日环比 | |||
| mapVo.put("weekPercentage",weekPercentage); //周同比 | |||
| return new ResultData(mapVo); | |||
| } | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setName(vo.getName()); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setCount(vo.getCount()); | |||
| @ApiOperation("查询用户消费金额") | |||
| @GetMapping("findUserAmountData") | |||
| private ResultData findUserAmountData() { | |||
| String tenantId = getTenantId(); | |||
| Calendar c =Calendar.getInstance(); | |||
| Date today = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date startTime = c.getTime(); | |||
| int thisMonthCount =wxCouponOrderService.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| Date eTime=c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| Date sTime =c.getTime(); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantId, sTime, eTime); | |||
| Map<String,Integer> dataMap = new HashMap<>(); | |||
| for(CUserDateAmountVo v:datas) { | |||
| dataMap.put(v.getxTime(), v.getPrice()); | |||
| } | |||
| Integer todayCount=0;//今日金额数 | |||
| Integer yesterdayCount =0;//昨日金额数 | |||
| Integer dayOfWeekCount=0;//上周x | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//周消费金额 | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周消费金额 | |||
| for(int i=29,sortNum=0;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| vo.setSortNum(sortNum++); | |||
| if(dataMap.get(dateStr)!=null) { | |||
| int price= dataMap.get(dateStr); | |||
| vo.setPrice(price); | |||
| }else { | |||
| vo.setPrice(0); | |||
| } | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setName(vo.getName()); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setPrice(vo.getPrice()); | |||
| if (i == 0) { | |||
| yesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 1) { | |||
| beforeYesterdayCount = vow.getCount(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getCount(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| thisMonthCount += vo.getCount(); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage = "--"; | |||
| if (beforeYesterdayCount > 0) { | |||
| Long count = yesterdayCount - beforeYesterdayCount; | |||
| dayPercentage = nf.format(count.doubleValue() / new Double(beforeYesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage = "--"; | |||
| if (dayOfWeekCount > 0) { | |||
| Long count = yesterdayCount - dayOfWeekCount; | |||
| weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String, Object> mapVo = new HashMap<>(); | |||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | |||
| mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 | |||
| mapVo.put("weekVos", weekVos);//周活跃数列表 | |||
| mapVo.put("monthVos", monthVos);//月活跃数列表 | |||
| mapVo.put("dayPercentage", dayPercentage);//日环比 | |||
| mapVo.put("weekPercentage", weekPercentage); //周同比 | |||
| return new ResultData(mapVo); | |||
| } | |||
| @ApiOperation("查询用户消费金额") | |||
| @GetMapping("findUserAmountData") | |||
| private ResultData findUserAmountData() { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAmountData"); | |||
| String tenantId = getTenantId(); | |||
| Calendar c = Calendar.getInstance(); | |||
| Date today = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date startTime = c.getTime(); | |||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| Date eTime = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| Date sTime = c.getTime(); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantId, sTime, eTime); | |||
| Map<String, Integer> dataMap = new HashMap<>(); | |||
| for (CUserDateAmountVo v : datas) { | |||
| dataMap.put(v.getxTime(), v.getPrice()); | |||
| } | |||
| Integer todayCount = 0;//今日金额数 | |||
| Integer yesterdayCount = 0;//昨日金额数 | |||
| Integer dayOfWeekCount = 0;//上周x | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//周消费金额 | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周消费金额 | |||
| for (int i = 29, sortNum = 0; i >= 0; i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| vo.setSortNum(sortNum++); | |||
| if (dataMap.get(dateStr) != null) { | |||
| int price = dataMap.get(dateStr); | |||
| vo.setPrice(price); | |||
| } else { | |||
| vo.setPrice(0); | |||
| } | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setName(vo.getName()); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setPrice(vo.getPrice()); | |||
| if (i == 0) { | |||
| todayCount = vow.getPrice(); | |||
| } | |||
| if (i == 1) { | |||
| yesterdayCount = vow.getPrice(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getPrice(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage = "--"; | |||
| if (yesterdayCount > 0) { | |||
| Integer count = todayCount - yesterdayCount; | |||
| dayPercentage = nf.format(count.doubleValue() / new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage = "--"; | |||
| if (dayOfWeekCount > 0) { | |||
| Integer count = todayCount - dayOfWeekCount; | |||
| weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String, Object> map = new HashMap<>(); | |||
| DecimalFormat df = new DecimalFormat("0.00"); | |||
| map.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 | |||
| String thisMonthCountStr = df.format((float) thisMonthCount / 100); | |||
| map.put("thisMonthCount", thisMonthCountStr);//近一个月消费金额数 | |||
| map.put("dayPercentage", dayPercentage);//日环比 | |||
| map.put("weekPercentage", weekPercentage); //周同比 | |||
| map.put("weekVos", weekVos);//一周金额列表 | |||
| map.put("monthVos", monthVos);//一月金额列表 | |||
| return new ResultData(map); | |||
| } | |||
| if (i == 0) { | |||
| todayCount = vow.getPrice(); | |||
| } | |||
| if (i == 1) { | |||
| yesterdayCount = vow.getPrice(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getPrice(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage ="--"; | |||
| if(yesterdayCount>0) { | |||
| Integer count =todayCount-yesterdayCount; | |||
| dayPercentage=nf.format(count.doubleValue()/new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage ="--"; | |||
| if(dayOfWeekCount>0) { | |||
| Integer count =todayCount-dayOfWeekCount; | |||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String,Object> map =new HashMap<>(); | |||
| DecimalFormat df=new DecimalFormat("0.00"); | |||
| map.put("todayCount", df.format((float)todayCount/100));//今日消费金额 | |||
| String thisMonthCountStr = df.format((float)thisMonthCount/100); | |||
| map.put("thisMonthCount", thisMonthCountStr);//近一个月消费金额数 | |||
| map.put("dayPercentage",dayPercentage);//日环比 | |||
| map.put("weekPercentage",weekPercentage); //周同比 | |||
| map.put("weekVos", weekVos);//一周金额列表 | |||
| map.put("monthVos", monthVos);//一月金额列表 | |||
| return new ResultData(map); | |||
| } | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxCUserTagsController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCUserTags wxCUserTags, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserTagsController::list"); | |||
| if (null == wxCUserTags) wxCUserTags = new WxCUserTags(); | |||
| final PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(wxCUserTags, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxCUserTagsController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCUserTags wxCUserTags) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserTagsController::add"); | |||
| //Assert.notNull(wxCUserTags.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCUserTagsService.saveOrUpdate(wxCUserTags); | |||
| @@ -44,6 +46,7 @@ public class WxCUserTagsController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCUserTags wxCUserTags) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserTagsController::update"); | |||
| wxCUserTagsService.saveOrUpdate(wxCUserTags); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxCUserTagsController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserTagsController::delete"); | |||
| wxCUserTagsService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxCUserTagsController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserTagsController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCUserTagsService.getById(id)); | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCampaign; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import com.iformall.enums.EnumCampaignStatus; | |||
| import com.iformall.enums.EnumCouponChannelType; | |||
| import com.iformall.service.WxCampaignService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| @@ -45,6 +46,7 @@ public class WxCampaignController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCampaign wxCampaign, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::list"); | |||
| if (null == wxCampaign) wxCampaign = new WxCampaign(); | |||
| if (wxCampaign.getStatus() != null && wxCampaign.getStatus() == -1) { | |||
| wxCampaign.setStatus(null); | |||
| @@ -58,6 +60,7 @@ public class WxCampaignController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCampaign wxCampaign) { | |||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::add"); | |||
| //Assert.notNull(wxCampaign.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| // int sortNum = wxCampaignService.getMaxSortNum(getTenantId()); | |||
| @@ -67,7 +70,7 @@ public class WxCampaignController extends BaseController { | |||
| } else { | |||
| wxCampaign.setCouponIds(JSONArray.toJSONString(new String[0])); | |||
| } | |||
| wxCampaign.setStatus(0); | |||
| wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||
| wxCampaign.setTenantId(getTenantId()); | |||
| // wxCampaign.setSortNum(sortNum+1); | |||
| wxCampaignService.saveOrUpdate(wxCampaign); | |||
| @@ -77,6 +80,7 @@ public class WxCampaignController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCampaign wxCampaign) { | |||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::update"); | |||
| if (StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||
| String[] arys = wxCampaign.getCouponIds().split(","); | |||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | |||
| @@ -91,6 +95,7 @@ public class WxCampaignController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::delete"); | |||
| wxCampaignService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -99,13 +104,14 @@ public class WxCampaignController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::findById"); | |||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | |||
| if (wxCampaign != null) { | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||
| wxCouponChannel.setStatus(0); | |||
| wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listAPI(wxCouponChannel); | |||
| wxCampaign.setCoupons(couponList); | |||
| } | |||
| @@ -118,6 +124,7 @@ public class WxCampaignController extends BaseController { | |||
| @ApiImplicitParam(name = "sourceId", value = "", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "targetId", value = "", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData move(Long sourceId, Long targetId) { | |||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::move"); | |||
| WxCampaign source = wxCampaignService.getById(sourceId); | |||
| WxCampaign target = wxCampaignService.getById(targetId); | |||
| if (source == null || target == null) { | |||
| @@ -67,7 +67,7 @@ public class WxCarCallBackController extends BaseController { | |||
| */ | |||
| @PostMapping(value = "/etcpParkInCallback") | |||
| public Result etcpParkInCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpParkInCallback: " + paramMap.toString()); | |||
| logger.info("["+getIpAddr()+"] etcpParkInCallback: " + paramMap.toString()); | |||
| Date currentDate = new Date(); | |||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||
| @@ -81,11 +81,11 @@ public class WxCarCallBackController extends BaseController { | |||
| String tenantId = "456"; | |||
| WxPark parkQ = new WxPark(); | |||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| parkQ.setParkId(etcpParkId); | |||
| parkQ.setParkingId(etcpParkId); | |||
| WxPark park = wxParkService.getByObj(parkQ); | |||
| if (park == null) { | |||
| logger.error("etcpParkInCallback: ETCP车场未找到" + etcpParkId); | |||
| //return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||
| } else { | |||
| tenantId = park.getTenantId(); | |||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||
| @@ -137,7 +137,7 @@ public class WxCarCallBackController extends BaseController { | |||
| */ | |||
| @PostMapping(value = "/etcpParkOutCallback") | |||
| public Result etcpParkOutCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpParkOutCallback: " + paramMap.toString()); | |||
| logger.info("["+getIpAddr()+"etcpParkOutCallback: " + paramMap.toString()); | |||
| Date currentDate = new Date(); | |||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||
| @@ -150,11 +150,11 @@ public class WxCarCallBackController extends BaseController { | |||
| String etcpParkId = paramMap.get("parkId"); | |||
| WxPark parkQ = new WxPark(); | |||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| parkQ.setParkId(etcpParkId); | |||
| parkQ.setParkingId(etcpParkId); | |||
| WxPark park = wxParkService.getByObj(parkQ); | |||
| if (park == null) { | |||
| logger.error("etcpParkOutCallback: ETCP车场未找到 " + etcpParkId); | |||
| //return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||
| } else { | |||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||
| } | |||
| @@ -180,7 +180,7 @@ public class WxCarCallBackController extends BaseController { | |||
| */ | |||
| @PostMapping(value = "/etcpUnbindCarCallBack") | |||
| public Result etcpUnbindCarCallBack(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpUnbindCarCallBack: " + paramMap.toString()); | |||
| logger.info("["+getIpAddr()+"etcpUnbindCarCallBack: " + paramMap.toString()); | |||
| String carNumber = paramMap.get("plateNumber"); | |||
| // TODO how to get the parkId | |||
| @@ -225,7 +225,7 @@ public class WxCarCallBackController extends BaseController { | |||
| */ | |||
| @PostMapping(value = "/etcpPaidCallback") | |||
| public Result etcpPaidCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpPaidCallback: " + paramMap.toString()); | |||
| logger.info("["+getIpAddr()+"etcpPaidCallback: " + paramMap.toString()); | |||
| String carNumber = paramMap.get("plateNumber"); | |||
| // TODO how to get the parkId | |||
| @@ -269,7 +269,7 @@ public class WxCarCallBackController extends BaseController { | |||
| */ | |||
| @RequestMapping(value = "/tjdParkInCallback") | |||
| public Map tjdParkInCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("tjdParkInCallback: " + paramMap.toString()); | |||
| logger.info("["+getIpAddr()+"tjdParkInCallback: " + paramMap.toString()); | |||
| Map map = new HashMap(); | |||
| @@ -322,7 +322,7 @@ public class WxCarCallBackController extends BaseController { | |||
| */ | |||
| @RequestMapping(value = "/tjdParkoutCallback") | |||
| public Map tjdParkOutCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("tjdParkoutCallback: " + paramMap.toString()); | |||
| logger.info("["+getIpAddr()+"tjdParkoutCallback: " + paramMap.toString()); | |||
| Map map = new HashMap(); | |||
| @@ -27,6 +27,7 @@ public class WxCarCmdLogController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCarCmdLog wxCarCmdLogs, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarCmdLogController::list"); | |||
| if (null == wxCarCmdLogs) wxCarCmdLogs = new WxCarCmdLog(); | |||
| final PageInfo<WxCarCmdLog> page = wxCarCmdLogService.listAsPage(wxCarCmdLogs, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxCarCmdLogController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCarCmdLog wxCarCmdLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarCmdLogController::add"); | |||
| //Assert.notNull(wxCarCmdLogs.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| @@ -44,6 +46,7 @@ public class WxCarCmdLogController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCarCmdLog wxCarCmdLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarCmdLogController::update"); | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxCarCmdLogController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarCmdLogController::delete"); | |||
| wxCarCmdLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxCarCmdLogController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarCmdLogController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCarCmdLogService.getById(id)); | |||
| } | |||
| @@ -64,6 +64,7 @@ public class WxCarController extends BaseController { | |||
| @ApiOperation(value = "获取车场支持的厂家", notes = "{}") | |||
| @GetMapping("/getVendor") | |||
| public ResultData getVendor() { | |||
| logger.debug("[" + getIpAddr() + "] WxCarController::getVendor"); | |||
| MallUserInfo user = getUser(); | |||
| // 1, get mall's park | |||
| WxPark park = getCurrentPark(user); | |||
| @@ -117,7 +118,7 @@ public class WxCarController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData quanTemplate(String merchantId, Integer pageNum, Integer pageSize) { | |||
| logger.info("quanTemplate: " + merchantId); | |||
| logger.debug("[" + getIpAddr() + "] WxCarController::quanTemplate"); | |||
| MallUserInfo user = getUser(); | |||
| /// 1, get mall's park | |||
| WxPark park = getCurrentPark(user); | |||
| @@ -177,6 +178,7 @@ public class WxCarController extends BaseController { | |||
| @ApiOperation("新增停车券接口") | |||
| @PostMapping("save") | |||
| public ResultData save(@RequestBody WxCouponCarVo coupon) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarController::save"); | |||
| logger.info(coupon.toString()); | |||
| //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| @@ -215,12 +217,19 @@ public class WxCarController extends BaseController { | |||
| wxCoupon.setUsePrice((int) (Double.parseDouble(coupon.getUsePriceStr()) * 100)); | |||
| } | |||
| if (StringUtils.isNotEmpty(coupon.getPriceStr())) { | |||
| wxCoupon.setPrice((int) (Double.parseDouble(coupon.getPriceStr()) * 100)); | |||
| // 不管时间是小时还是金额,都乘100 | |||
| String priceStr = coupon.getPriceStr(); | |||
| priceStr = priceStr.replace("元", ""); | |||
| priceStr = priceStr.replace("小时", ""); | |||
| wxCoupon.setPrice((int) (Double.parseDouble(priceStr) * 100)); | |||
| } | |||
| if (StringUtils.isNotBlank(coupon.getBusiness())) { | |||
| String[] arys = coupon.getBusiness().split(","); | |||
| wxCoupon.setBusiness(JSON.toJSONString(arys)); | |||
| } | |||
| if(coupon.getId() != null && coupon.getId().longValue() > 0) { | |||
| wxCoupon.setId(coupon.getId()); | |||
| } | |||
| wxCoupon.setType(coupon.getType()); | |||
| wxCoupon.setCoverImg(coupon.getCoverImg()); | |||
| wxCoupon.setTitle(coupon.getTitle()); | |||
| @@ -272,6 +281,7 @@ public class WxCarController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData getTemplateAmountSum(Long templateId) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAmountSum"); | |||
| Map map = new HashMap(); | |||
| Integer amountCount = 0; | |||
| try { | |||
| @@ -288,6 +298,7 @@ public class WxCarController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData getTemplateAvailSum(Long templateId) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarController::getTemplateAvailSum"); | |||
| Map map = new HashMap(); | |||
| Integer availCount = 0; | |||
| try { | |||
| @@ -302,6 +313,7 @@ public class WxCarController extends BaseController { | |||
| @ApiOperation("停车券detail") | |||
| @GetMapping("/detail") | |||
| public ResultData getCouponCarDetail(@ModelAttribute WxCoupon coupon) { | |||
| logger.debug("[" + getIpAddr() + "] WxCarController::getCouponCarDetail"); | |||
| MallUserInfo user = getUser(); | |||
| coupon.setTenantId(user.getTenantId()); | |||
| try { | |||
| @@ -27,6 +27,7 @@ public class WxChannelController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxChannel wxChannel, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxChannelController::list"); | |||
| if (null == wxChannel) wxChannel = new WxChannel(); | |||
| final PageInfo<WxChannel> page = wxChannelService.listAsPage(wxChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxChannelController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxChannel wxChannel) { | |||
| logger.debug("[" + getIpAddr() + "] WxChannelController::add"); | |||
| //Assert.notNull(wxChannel.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxChannelService.saveOrUpdate(wxChannel); | |||
| @@ -44,6 +46,7 @@ public class WxChannelController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxChannel wxChannel) { | |||
| logger.debug("[" + getIpAddr() + "] WxChannelController::update"); | |||
| wxChannelService.saveOrUpdate(wxChannel); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxChannelController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxChannelController::delete"); | |||
| wxChannelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxChannelController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxChannelController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxChannelService.getById(id)); | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxCouponActionLogController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponActionLog wxCouponActionLog, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponActionLogController::list"); | |||
| if (null == wxCouponActionLog) wxCouponActionLog = new WxCouponActionLog(); | |||
| final PageInfo<WxCouponActionLog> page = wxCouponActionLogService.listAsPage(wxCouponActionLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxCouponActionLogController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponActionLog wxCouponActionLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponActionLogController::add"); | |||
| //Assert.notNull(wxCouponActionLog.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCouponActionLogService.saveOrUpdate(wxCouponActionLog); | |||
| @@ -44,6 +46,7 @@ public class WxCouponActionLogController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponActionLog wxCouponActionLog) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponActionLogController::update"); | |||
| wxCouponActionLogService.saveOrUpdate(wxCouponActionLog); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxCouponActionLogController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponActionLogController::delete"); | |||
| wxCouponActionLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxCouponActionLogController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponActionLogController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponActionLogService.getById(id)); | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxCouponCarController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponCar wxCouponCar, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponCarController::list"); | |||
| if (null == wxCouponCar) wxCouponCar = new WxCouponCar(); | |||
| final PageInfo<WxCouponCar> page = wxCouponCarService.listAsPage(wxCouponCar, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxCouponCarController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponCar wxCouponCar) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponCarController::add"); | |||
| //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCouponCarService.save(wxCouponCar); | |||
| @@ -44,6 +46,7 @@ public class WxCouponCarController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponCar wxCouponCar) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponCarController::update"); | |||
| wxCouponCarService.update(wxCouponCar); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxCouponCarController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponCarController::delete"); | |||
| wxCouponCarService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxCouponCarController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponCarController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponCarService.getById(id)); | |||
| } | |||
| @@ -45,13 +45,14 @@ public class WxCouponChannelController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::list"); | |||
| if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | |||
| if (wxCouponChannel.getStatus() != null && wxCouponChannel.getStatus() == -1) { | |||
| wxCouponChannel.setStatus(null); | |||
| } | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC); | |||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | |||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize ,false); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -59,6 +60,7 @@ public class WxCouponChannelController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::update"); | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| if (wxCouponChannel.getCouponId() != null && wxCouponChannel.getStatus() != null) { | |||
| WxCouponChannel orignal = wxCouponChannelService.getById(wxCouponChannel.getId()); | |||
| @@ -91,6 +93,7 @@ public class WxCouponChannelController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::delete"); | |||
| wxCouponChannelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -99,12 +102,14 @@ public class WxCouponChannelController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id)); | |||
| } | |||
| @ApiOperation("批量新增") | |||
| @PostMapping("/addbatch") | |||
| public ResultData addbatch(@RequestBody WxCouponChannelDto wxCouponChannelDto) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::addbatch"); | |||
| String[] ids = wxCouponChannelDto.getCouponIds().split(","); | |||
| String[] channelId = wxCouponChannelDto.getChannelId().split(","); | |||
| MallUserInfo user = getUser(); | |||
| @@ -115,6 +120,7 @@ public class WxCouponChannelController extends BaseController { | |||
| @GetMapping("/findChannelByCouponId") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findChannelByCouponId(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::findChannelByCouponId"); | |||
| List<Integer> channellist = new ArrayList<>(); | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| @@ -48,6 +48,7 @@ public class WxCouponController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::list"); | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(getTenantId()); | |||
| wxCoupon.setSortColumns(WxCoupon.Field.Id_DESC); | |||
| @@ -100,6 +101,7 @@ public class WxCouponController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCoupon wxCoupon) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::add"); | |||
| //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| if (StringUtils.isNotEmpty(wxCoupon.getSalePriceStr())) { | |||
| @@ -124,6 +126,7 @@ public class WxCouponController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCoupon wxCoupon) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::update"); | |||
| if (wxCoupon.getId() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| @@ -138,6 +141,7 @@ public class WxCouponController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | |||
| wxCouponService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -146,6 +150,7 @@ public class WxCouponController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); | |||
| WxCoupon c = wxCouponService.getById(id); | |||
| WxMerchant merchant = wxMerchantService.getById(c.getMerchantId()); | |||
| if(merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) | |||
| @@ -163,6 +168,7 @@ public class WxCouponController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::sendList"); | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(getTenantId()); | |||
| wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||
| @@ -4,11 +4,8 @@ import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.CouponInject; | |||
| import com.iformall.domain.po.WxMsg; | |||
| import com.iformall.domain.po.WxMsgModel; | |||
| import com.iformall.enums.EnumCouponInjectSendType; | |||
| import com.iformall.service.CouponInjectService; | |||
| import com.iformall.domain.po.WxCouponInject; | |||
| import com.iformall.service.WxCouponInjectService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxMsgModelService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -21,17 +18,16 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Api(description = "精准投放接口") | |||
| @RestController | |||
| @RequestMapping("couponInject") | |||
| public class CouponInjectController extends BaseController { | |||
| public class WxCouponInjectController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private CouponInjectService couponInjectService; | |||
| private WxCouponInjectService wxCouponInjectService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| @@ -42,37 +38,40 @@ public class CouponInjectController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute CouponInject couponInject, Integer pageNum, Integer pageSize) { | |||
| if (null == couponInject) couponInject = new CouponInject(); | |||
| public ResultData list(@ModelAttribute WxCouponInject couponInject, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponInjectController::list"); | |||
| if (null == couponInject) couponInject = new WxCouponInject(); | |||
| if (couponInject.getStatus() != null && couponInject.getStatus() == -1) { | |||
| couponInject.setStatus(null); | |||
| } | |||
| couponInject.setTenantId(getTenantId()); | |||
| couponInject.setSortColumns(CouponInject.Field.Id_DESC); | |||
| final PageInfo<CouponInject> page = couponInjectService.listAsPage(couponInject, pageNum, pageSize); | |||
| couponInject.setSortColumns(WxCouponInject.Field.Id_DESC); | |||
| final PageInfo<WxCouponInject> page = wxCouponInjectService.listAsPage(couponInject, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody CouponInject couponInject) { | |||
| public ResultData add(@RequestBody WxCouponInject couponInject) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponInjectController::add"); | |||
| couponInject.setTenantId(getUser().getTenantId()); | |||
| couponInject.setMUserId(getUser().getId()); | |||
| return couponInjectService.add(couponInject); | |||
| return wxCouponInjectService.add(couponInject); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody CouponInject couponInject) { | |||
| public ResultData update(@RequestBody WxCouponInject couponInject) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponInjectController::update"); | |||
| String[] arys = couponInject.getTags().split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| couponInject.setTags(JSON.toJSONString(arys)); | |||
| couponInjectService.saveOrUpdate(couponInject); | |||
| wxCouponInjectService.saveOrUpdate(couponInject); | |||
| return new ResultData(); | |||
| } | |||
| @@ -80,7 +79,8 @@ public class CouponInjectController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| couponInjectService.deleteById(id); | |||
| logger.debug("[" + getIpAddr() + "] WxCouponInjectController::delete"); | |||
| wxCouponInjectService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -88,12 +88,12 @@ public class CouponInjectController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| CouponInject couponInject = couponInjectService.getById(id); | |||
| logger.debug("[" + getIpAddr() + "] WxCouponInjectController::findById"); | |||
| WxCouponInject couponInject = wxCouponInjectService.getById(id); | |||
| if (couponInject != null) { | |||
| List<Long> tagids = JSON.parseArray(couponInject.getTags(), Long.class); | |||
| if (!tagids.isEmpty()) { | |||
| couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(getTenantId(), tagids)); | |||
| couponInject.setTagsList(wxCUserTagsService.findTagList(getTenantId(), tagids)); | |||
| } | |||
| couponInject.setMsgModel(wxMsgModelService.getById(couponInject.getModelId())); | |||
| @@ -6,6 +6,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.config.PayProperty; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumRefundWay; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -24,6 +25,8 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -49,24 +52,58 @@ public class WxCouponOrderController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | |||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrder(); | |||
| public ResultData list(@ModelAttribute WxCouponOrderBVo wxCouponOrder, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponOrderController::list"); | |||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderBVo(); | |||
| wxCouponOrder.setTenantId(getTenantId()); | |||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | |||
| ResultData rd = wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); | |||
| return rd; | |||
| return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); | |||
| } | |||
| @RequestMapping("/exportData") | |||
| public void exportData(HttpServletRequest request, HttpServletResponse response) { | |||
| public void exportData( | |||
| @RequestParam("endDate") String endDate, | |||
| @RequestParam("startDate") String startDate, | |||
| @RequestParam("merchantName") String merchantName, | |||
| @RequestParam("couponOrderStatus") String couponOrderStatus, | |||
| @RequestParam("id") String id, | |||
| HttpServletRequest request, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponOrderController::exportData"); | |||
| wxCouponOrderService.exportData(request, response, getTenantId()); | |||
| WxCouponOrderBVo wxCouponOrder = new WxCouponOrderBVo(); | |||
| wxCouponOrder.setTenantId(getTenantId()); | |||
| wxCouponOrder.setMerchantName(merchantName); | |||
| try { | |||
| wxCouponOrder.setId(Long.valueOf(id)); | |||
| }catch (Exception e){ | |||
| wxCouponOrder.setId(null); | |||
| } | |||
| try { | |||
| wxCouponOrder.setCouponOrderStatus(Integer.valueOf(couponOrderStatus)); | |||
| }catch (Exception e){ | |||
| wxCouponOrder.setCouponOrderStatus(null); | |||
| } | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| try { | |||
| wxCouponOrder.setStartDate( sdf.parse(startDate)); | |||
| } catch (Exception e) { | |||
| wxCouponOrder.setStartDate(null); | |||
| } | |||
| try { | |||
| wxCouponOrder.setEndDate( sdf.parse(endDate)); | |||
| } catch (Exception e) { | |||
| wxCouponOrder.setEndDate(null); | |||
| } | |||
| wxCouponOrderService.exportData(request, response, wxCouponOrder); | |||
| } | |||
| @ApiOperation(value = "退券退款", notes = "{\"couponOrderId\":\"string\"}") | |||
| @PostMapping("/refund") | |||
| public ResultData create(@RequestBody Map<String, String> paramMap) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponOrderController::create"); | |||
| //Assert.notNull(wxRefundOrder.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| logger.info(paramMap.toString()); | |||
| @@ -41,6 +41,7 @@ public class WxCouponSendController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::list"); | |||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | |||
| wxCouponSend.setTenantId(getTenantId()); | |||
| wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); | |||
| @@ -56,6 +57,7 @@ public class WxCouponSendController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponSend wxCouponSend) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::add"); | |||
| if (null == wxCouponSend) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| } | |||
| @@ -89,6 +91,7 @@ public class WxCouponSendController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponSend wxCouponSend) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::update"); | |||
| wxCouponSend.setTenantId(getTenantId()); | |||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||
| return new ResultData(); | |||
| @@ -98,6 +101,7 @@ public class WxCouponSendController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::delete"); | |||
| //wxCouponSendService.deleteById(id); | |||
| //return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| WxCouponSend wxCouponSend = wxCouponSendService.getById(id); | |||
| @@ -113,6 +117,7 @@ public class WxCouponSendController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponSendService.getById(id)); | |||
| } | |||
| @@ -31,6 +31,7 @@ public class WxCouponSpreadController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponSpread wxCouponSpread, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSpreadController::list"); | |||
| if (null == wxCouponSpread) wxCouponSpread = new WxCouponSpread(); | |||
| final PageInfo<WxCouponSpread> page = wxCouponSpreadService.listAsPage(wxCouponSpread, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -39,6 +40,7 @@ public class WxCouponSpreadController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponSpread wxCouponSpread) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSpreadController::add"); | |||
| if (wxCouponSpread.getCouponId() == null) { | |||
| return new ResultData(Result.ERROR, "没有找到券id"); | |||
| } | |||
| @@ -51,6 +53,7 @@ public class WxCouponSpreadController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponSpread wxCouponSpread) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSpreadController::update"); | |||
| wxCouponSpreadService.saveOrUpdate(wxCouponSpread); | |||
| return new ResultData(); | |||
| } | |||
| @@ -59,6 +62,7 @@ public class WxCouponSpreadController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSpreadController::delete"); | |||
| wxCouponSpreadService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -67,6 +71,7 @@ public class WxCouponSpreadController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSpreadController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponSpreadService.getById(id)); | |||
| } | |||
| @@ -74,6 +79,7 @@ public class WxCouponSpreadController extends BaseController { | |||
| @GetMapping("/findByCouponId") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findByCouponId(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponSpreadController::findByCouponId"); | |||
| WxCouponSpread result = null; | |||
| if (id != null) { | |||
| WxCouponSpread wxCouponSpread = new WxCouponSpread(); | |||
| @@ -29,6 +29,7 @@ public class WxCouponTypeController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponType wxCouponType, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponTypeController::list"); | |||
| if (null == wxCouponType) wxCouponType = new WxCouponType(); | |||
| final PageInfo<WxCouponType> page = wxCouponTypeService.listAsPage(wxCouponType, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -37,6 +38,7 @@ public class WxCouponTypeController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponType wxCouponType) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponTypeController::add"); | |||
| //Assert.notNull(wxCouponType.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCouponTypeService.saveOrUpdate(wxCouponType); | |||
| @@ -46,6 +48,7 @@ public class WxCouponTypeController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponType wxCouponType) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponTypeController::update"); | |||
| wxCouponTypeService.saveOrUpdate(wxCouponType); | |||
| return new ResultData(); | |||
| } | |||
| @@ -54,6 +57,7 @@ public class WxCouponTypeController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponTypeController::delete"); | |||
| wxCouponTypeService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -62,6 +66,7 @@ public class WxCouponTypeController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponTypeController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponTypeService.getById(id)); | |||
| } | |||
| @@ -0,0 +1,86 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxGame; | |||
| import com.iformall.enums.EnumGameStatus; | |||
| import com.iformall.service.WxGameService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxGame") | |||
| public class WxGameController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxGameService wxGameService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxGame wxGame, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameController::list"); | |||
| if (null == wxGame) wxGame = new WxGame(); | |||
| wxGame.setTenantId(getTenantId()); | |||
| wxGame.setSortColumns(WxGame.Field.Id_DESC); | |||
| final PageInfo<WxGame> page = wxGameService.listAsPage(wxGame, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxGame wxGame) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameController::add"); | |||
| //Assert.notNull(wxGame.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| if (StringUtils.isBlank(wxGame.getCouponIds())) { | |||
| wxGame.setCouponIds(JSONArray.toJSONString(new String[0])); | |||
| } | |||
| wxGame.setStatus(EnumGameStatus.STATUS_THROW_IN.getCode()); | |||
| wxGame.setTenantId(getTenantId()); | |||
| wxGameService.saveOrUpdate(wxGame); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxGame wxGame) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameController::update"); | |||
| if (StringUtils.isBlank(wxGame.getCouponIds())) { | |||
| wxGame.setCouponIds(JSONArray.toJSONString(new String[0])); | |||
| } | |||
| wxGame.setTenantId(getTenantId()); | |||
| wxGameService.saveOrUpdate(wxGame); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameController::delete"); | |||
| wxGameService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxGameService.getById(id)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxGameTemplate; | |||
| import com.iformall.service.WxGameTemplateService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| 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 java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxGameTemplate") | |||
| public class WxGameTemplateController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxGameTemplateService wxGameTemplateService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("listPage") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData listPage(@ModelAttribute WxGameTemplate wxGameTemplate, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameTemplateController::listPage"); | |||
| if (null == wxGameTemplate) wxGameTemplate = new WxGameTemplate(); | |||
| final PageInfo<WxGameTemplate> page = wxGameTemplateService.listAsPage(wxGameTemplate, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("列表接口") | |||
| @GetMapping("list") | |||
| public ResultData list(@ModelAttribute WxGameTemplate wxGameTemplate) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameTemplateController::list"); | |||
| if (null == wxGameTemplate) wxGameTemplate = new WxGameTemplate(); | |||
| final List<WxGameTemplate> page = wxGameTemplateService.getList(wxGameTemplate); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxGameTemplate wxGameTemplate) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameTemplateController::add"); | |||
| //Assert.notNull(wxGameTemplate.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxGameTemplateService.saveOrUpdate(wxGameTemplate); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxGameTemplate wxGameTemplate) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameTemplateController::update"); | |||
| wxGameTemplateService.saveOrUpdate(wxGameTemplate); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameTemplateController::delete"); | |||
| wxGameTemplateService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxGameTemplateController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxGameTemplateService.getById(id)); | |||
| } | |||
| } | |||
| @@ -25,6 +25,7 @@ public class WxGroupController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxGroup wxGroup, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxGroupController::list"); | |||
| if (null == wxGroup) wxGroup = new WxGroup(); | |||
| final PageInfo<WxGroup> page = wxGroupService.listAsPage(wxGroup, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -32,6 +33,7 @@ public class WxGroupController extends BaseController { | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxGroup wxGroup) { | |||
| logger.debug("[" + getIpAddr() + "] WxGroupController::add"); | |||
| //Assert.notNull(wxGroup.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxGroupService.saveOrUpdate(wxGroup); | |||
| @@ -40,6 +42,7 @@ public class WxGroupController extends BaseController { | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxGroup wxGroup) { | |||
| logger.debug("[" + getIpAddr() + "] WxGroupController::update"); | |||
| wxGroupService.saveOrUpdate(wxGroup); | |||
| return new ResultData(); | |||
| } | |||
| @@ -47,6 +50,7 @@ public class WxGroupController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| logger.debug("[" + getIpAddr() + "] WxGroupController::delete"); | |||
| wxGroupService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -54,6 +58,7 @@ public class WxGroupController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findById(String id) { | |||
| logger.debug("[" + getIpAddr() + "] WxGroupController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxGroupService.getById(id)); | |||
| } | |||
| @@ -37,6 +37,7 @@ public class WxLevelConfigController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxLevelConfig wxLevelConfig,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxLevelConfigController::list"); | |||
| if (null == wxLevelConfig) wxLevelConfig = new WxLevelConfig(); | |||
| wxLevelConfig.setTenantId(getTenantId()); | |||
| wxLevelConfig.setSortColumns(WxLevelConfig.Field.Points_ASC); | |||
| @@ -47,6 +48,7 @@ public class WxLevelConfigController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxLevelConfigDto dto) { | |||
| logger.debug("[" + getIpAddr() + "] WxLevelConfigController::add"); | |||
| //Assert.notNull(wxLevelConfig.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| String[] points = dto.getPoints().split("&"); | |||
| @@ -81,6 +83,7 @@ public class WxLevelConfigController extends BaseController { | |||
| @PostMapping("/del") | |||
| // @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(@RequestBody WxLevelConfig wxLevelConfig) { | |||
| logger.debug("[" + getIpAddr() + "] WxLevelConfigController::delete"); | |||
| wxLevelConfigService.deleteById(wxLevelConfig.getId()); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -89,6 +92,7 @@ public class WxLevelConfigController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxLevelConfigController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxLevelConfigService.getById(id)); | |||
| } | |||
| @@ -26,6 +26,7 @@ public class WxMallApplyController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMallApply wxMallApply, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallApplyController::list"); | |||
| if (null == wxMallApply) wxMallApply = new WxMallApply(); | |||
| final PageInfo<WxMallApply> page = wxMallApplyService.listAsPage(wxMallApply, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -33,6 +34,7 @@ public class WxMallApplyController extends BaseController { | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMallApply wxMallApply) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallApplyController::add"); | |||
| //Assert.notNull(wxMallApply.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| return wxMallApplyService.saveOrUpdate(wxMallApply); | |||
| @@ -41,12 +43,14 @@ public class WxMallApplyController extends BaseController { | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMallApply wxMallApply) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallApplyController::update"); | |||
| return wxMallApplyService.saveOrUpdate(wxMallApply); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallApplyController::delete"); | |||
| wxMallApplyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -54,6 +58,7 @@ public class WxMallApplyController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findById(String id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallApplyController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMallApplyService.getById(id)); | |||
| } | |||
| @@ -63,6 +68,7 @@ public class WxMallApplyController extends BaseController { | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true)}) | |||
| public ResultData sendvalidationcode(String phone, Integer type) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallApplyController::sendvalidationcode"); | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId("1"); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| @@ -27,6 +27,7 @@ public class WxMallBuildingController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMallBuilding wxMallBuilding,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::list"); | |||
| if (null == wxMallBuilding) wxMallBuilding = new WxMallBuilding(); | |||
| final PageInfo<WxMallBuilding> page = wxMallBuildingService.listAsPage(wxMallBuilding, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxMallBuildingController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMallBuilding wxMallBuilding) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::add"); | |||
| //Assert.notNull(wxMallBuilding.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMallBuildingService.saveOrUpdate(wxMallBuilding); | |||
| @@ -44,6 +46,7 @@ public class WxMallBuildingController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMallBuilding wxMallBuilding) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::update"); | |||
| wxMallBuildingService.saveOrUpdate(wxMallBuilding); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxMallBuildingController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::delete"); | |||
| wxMallBuildingService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxMallBuildingController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMallBuildingService.getById(id)); | |||
| } | |||
| @@ -67,13 +72,15 @@ public class WxMallBuildingController extends BaseController { | |||
| @ApiOperation("获取所有数据") | |||
| @GetMapping("getbuildinglist") | |||
| public ResultData getbuildinglist() { | |||
| return wxMallBuildingService.getbuildinglist(getTenantId()); | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::getbuildinglist"); | |||
| return wxMallBuildingService.getbuildinglist(getTenantId()); | |||
| } | |||
| @ApiOperation("获取楼层楼座数据") | |||
| @GetMapping("getbuildingfloorlist") | |||
| public ResultData getbuildingfloorlist() { | |||
| return wxMallBuildingService.getbuildingfloorlist(getTenantId()); | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::getbuildingfloorlist"); | |||
| return wxMallBuildingService.getbuildingfloorlist(getTenantId()); | |||
| } | |||
| @@ -21,8 +21,9 @@ public class WxMallConfigController extends BaseController { | |||
| private WxMallConfigService wxMallConfigService; | |||
| @ApiOperation("获取停车劵开关") | |||
| @GetMapping("getStopCarConpon") | |||
| @GetMapping("getStopCarCoupon") | |||
| public ResultData getStopCarConpon() { | |||
| logger.debug("[" + getIpAddr() + "] WxMallConfigController::getStopCarConpon"); | |||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||
| wxMallConfig.setKey("stopCarCouponSwitch"); | |||
| wxMallConfig.setTenantId(getTenantId()); | |||
| @@ -35,10 +36,11 @@ public class WxMallConfigController extends BaseController { | |||
| } | |||
| @ApiOperation("获取核销劵开关") | |||
| @GetMapping("getVerifyConpon") | |||
| @GetMapping("getVerifyCoupon") | |||
| public ResultData getVerifyConpon() { | |||
| logger.debug("[" + getIpAddr() + "] WxMallConfigController::getVerifyConpon"); | |||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||
| wxMallConfig.setKey("verifyConponSwitch"); | |||
| wxMallConfig.setKey("verifyCouponSwitch"); | |||
| wxMallConfig.setTenantId(getTenantId()); | |||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||
| if (page.getSize() > 0) { | |||
| @@ -48,9 +50,25 @@ public class WxMallConfigController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("updateStopCarConpon") | |||
| @ApiOperation("修改停车开关") | |||
| @ApiOperation("获取B端刷卡支付发劵开关") | |||
| @GetMapping("getMicroPayCouponSwitch") | |||
| public ResultData getMicroPayConpon() { | |||
| logger.debug("[" + getIpAddr() + "] WxMallConfigController::getMicroPayConpon"); | |||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||
| wxMallConfig.setKey("microPayCouponSwitch"); | |||
| wxMallConfig.setTenantId(getTenantId()); | |||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||
| if (page.getSize() > 0) { | |||
| WxMallConfig config = page.getList().get(0); | |||
| return new ResultData(config); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("updateStopCarCoupon") | |||
| @ApiOperation("修改停车发券开关") | |||
| public ResultData updateStopCarConpon(@RequestBody WxMallConfig wxMallConfig) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallConfigController::updateStopCarConpon"); | |||
| WxMallConfig temp = new WxMallConfig(); | |||
| // temp.setKey("stopCarCouponSwitch"); | |||
| temp.setValue(wxMallConfig.getValue()); | |||
| @@ -59,11 +77,25 @@ public class WxMallConfigController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("updateVerifyConpon") | |||
| @ApiOperation("修改核销开关") | |||
| @PostMapping("updateVerifyCoupon") | |||
| @ApiOperation("修改核销发券开关") | |||
| public ResultData updateVerifyConpon(@RequestBody WxMallConfig wxMallConfig) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallConfigController::updateVerifyConpon"); | |||
| WxMallConfig temp = new WxMallConfig(); | |||
| // temp.setKey("verifyCouponSwitch"); | |||
| temp.setValue(wxMallConfig.getValue()); | |||
| temp.setId(wxMallConfig.getId()); | |||
| wxMallConfigService.saveOrUpdate(temp); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("updateMicroPayCouponSwitch") | |||
| @ApiOperation("修改刷卡支付发券开关") | |||
| public ResultData updateMicroPayCoupon(@RequestBody WxMallConfig wxMallConfig) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallConfigController::updateMicroPayCoupon"); | |||
| WxMallConfig temp = new WxMallConfig(); | |||
| // temp.setKey("verifyConponSwitch"); | |||
| // temp.setKey("verifyCouponSwitch"); | |||
| temp.setValue(wxMallConfig.getValue()); | |||
| temp.setId(wxMallConfig.getId()); | |||
| wxMallConfigService.saveOrUpdate(temp); | |||
| @@ -1,42 +1,42 @@ | |||
| package com.iformall.controller; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.service.WxMallService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| 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.*; | |||
| @RestController | |||
| @RequestMapping("wxMall") | |||
| public class WxMallController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMall wxMall,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMall) wxMall = new WxMall(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMall wxMall, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::list"); | |||
| if (null == wxMall) wxMall = new WxMall(); | |||
| final PageInfo<WxMall> page = wxMallService.listAsPage(wxMall, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMall wxMall) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::add"); | |||
| //Assert.notNull(wxMall.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMallService.saveOrUpdate(wxMall); | |||
| @@ -46,29 +46,34 @@ public class WxMallController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMall wxMall) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::update"); | |||
| wxMallService.saveOrUpdate(wxMall); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::delete"); | |||
| wxMallService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMallService.getById(id)); | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMallService.getById(id)); | |||
| } | |||
| @ApiOperation("查询当前mall的信息") | |||
| @GetMapping("/mallinfo") | |||
| public ResultData mallinfo() { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::mallinfo"); | |||
| return new ResultData(wxMallService.getByTenantId(getTenantId())); | |||
| } | |||
| } | |||
| @@ -29,6 +29,7 @@ public class WxMallFloorController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMallFloor wxMallFloor,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::list"); | |||
| if (null == wxMallFloor) wxMallFloor = new WxMallFloor(); | |||
| final PageInfo<WxMallFloor> page = wxMallFloorService.listAsPage(wxMallFloor, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -37,6 +38,7 @@ public class WxMallFloorController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMallFloor wxMallFloor) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::add"); | |||
| //Assert.notNull(wxMallFloor.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMallFloorService.saveOrUpdate(wxMallFloor); | |||
| @@ -46,6 +48,7 @@ public class WxMallFloorController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMallFloor wxMallFloor) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::update"); | |||
| wxMallFloorService.saveOrUpdate(wxMallFloor); | |||
| return new ResultData(); | |||
| } | |||
| @@ -54,6 +57,7 @@ public class WxMallFloorController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::delete"); | |||
| wxMallFloorService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -62,7 +66,8 @@ public class WxMallFloorController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMallFloorService.getById(id)); | |||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMallFloorService.getById(id)); | |||
| } | |||
| @ApiOperation("获取所有数据") | |||
| @@ -70,6 +75,7 @@ public class WxMallFloorController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="buildingId",value="楼座ID",dataType="Long", paramType = "query",required=true)}) | |||
| public ResultData getfloorlist(Long buildingId){ | |||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::getfloorlist"); | |||
| return wxMallFloorService.getfloorlist(getTenantId(),buildingId); | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMerchantBUser wxMerchantBUser,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::list"); | |||
| if (null == wxMerchantBUser) wxMerchantBUser = new WxMerchantBUser(); | |||
| final PageInfo<WxMerchantBUser> page = wxMerchantBUserService.listAsPage(wxMerchantBUser, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMerchantBUser wxMerchantBUser) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::add"); | |||
| //Assert.notNull(wxMerchantBUser.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMerchantBUser.setTenantId(getTenantId()); | |||
| @@ -45,6 +47,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMerchantBUser wxMerchantBUser) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::update"); | |||
| Long id = wxMerchantBUserService.saveOrUpdate(wxMerchantBUser); | |||
| return new ResultData(Result.SUCCESS,"更新成功",id); | |||
| } | |||
| @@ -53,6 +56,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::delete"); | |||
| wxMerchantBUserService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -61,6 +65,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMerchantBUserService.getById(id)); | |||
| } | |||
| @@ -68,6 +73,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @GetMapping("/hasphone") | |||
| @ApiImplicitParam(name="phone",value="phone",dataType="String", paramType = "query",required=true) | |||
| public ResultData hasphone(String phone) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::hasphone"); | |||
| boolean has=wxMerchantBUserService.hasphone(phone,getTenantId()); | |||
| return new ResultData(Result.SUCCESS,"查询成功",has); | |||
| } | |||
| @@ -17,6 +17,9 @@ import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxMerchant") | |||
| public class WxMerchantController extends BaseController { | |||
| @@ -34,6 +37,7 @@ public class WxMerchantController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| wxMerchant.setSortColumns(WxMerchant.Field.Id_DESC); | |||
| @@ -41,36 +45,22 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("ETCP商户列表") | |||
| @GetMapping("etcplist") | |||
| public ResultData etcpList(@ModelAttribute WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::etcpList"); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| final List<WxMerchant> merchantList = wxMerchantService.etcpList(wxMerchant); | |||
| return new ResultData(merchantList); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMerchant wxMerchant) { | |||
| //Assert.notNull(wxMerchant.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| wxMerchantService.saveOrUpdate(wxMerchant); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMerchant wxMerchant) { | |||
| wxMerchantService.saveOrUpdate(wxMerchant); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::delete"); | |||
| wxMerchantService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -79,8 +69,8 @@ public class WxMerchantController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant = wxMerchantService.getById(id); | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::findById"); | |||
| WxMerchant wxMerchant = wxMerchantService.getById(id); | |||
| if (wxMerchant != null) { | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(wxMerchant); | |||
| if (receiver != null){ | |||
| @@ -96,8 +86,42 @@ public class WxMerchantController extends BaseController { | |||
| @GetMapping("disable") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData disable(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::disable"); | |||
| wxMerchantService.disable(id); | |||
| return new ResultData(Result.SUCCESS, "停用成功"); | |||
| } | |||
| @ApiOperation("新增商户接口") | |||
| @PostMapping("addMerchant") | |||
| public ResultData addMerchant(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::addMerchant"); | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| return wxMerchantService.addMerchant(wxMerchant); | |||
| } | |||
| @ApiOperation("更新商户接口") | |||
| @PostMapping("updateMerchant") | |||
| public ResultData updateMerchant(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchant"); | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| return wxMerchantService.updateMerchant(wxMerchant); | |||
| } | |||
| @ApiOperation("更新账户接口") | |||
| @PostMapping("updateMerchantAccount") | |||
| public ResultData updateMerchantAccount(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantAccount"); | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| return wxMerchantService.updateMerchantAccount(wxMerchant); | |||
| } | |||
| @ApiOperation("更新管理员接口") | |||
| @PostMapping("updateMerchantAdmin") | |||
| public ResultData updateMerchantAdmin(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantAdmin"); | |||
| wxMerchant.setTenantId(getTenantId()); | |||
| return wxMerchantService.updateMerchantAdmin(wxMerchant); | |||
| } | |||
| } | |||
| @@ -28,6 +28,7 @@ public class WxMerchantShopController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMerchantShop wxMerchantShop, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::list"); | |||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||
| final PageInfo<WxMerchantShop> page = wxMerchantShopService.listAsPage(wxMerchantShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -39,6 +40,7 @@ public class WxMerchantShopController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData queryShopList(@ModelAttribute WxMerchantShop wxMerchantShop, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::queryShopList"); | |||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||
| final PageInfo<WxShop> page = wxMerchantShopService.queryShopList(wxMerchantShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -48,6 +50,7 @@ public class WxMerchantShopController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMerchantShop wxMerchantShop) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::add"); | |||
| //Assert.notNull(wxMerchantShop.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMerchantShopService.saveOrUpdate(wxMerchantShop); | |||
| @@ -57,6 +60,7 @@ public class WxMerchantShopController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMerchantShop wxMerchantShop) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::update"); | |||
| wxMerchantShopService.saveOrUpdate(wxMerchantShop); | |||
| return new ResultData(); | |||
| } | |||
| @@ -65,6 +69,7 @@ public class WxMerchantShopController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::delete"); | |||
| wxMerchantShopService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -73,6 +78,7 @@ public class WxMerchantShopController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantShopService.getById(id)); | |||
| } | |||
| @@ -1,9 +1,9 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMerchantTradeDaily; | |||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | |||
| import com.iformall.service.WxMerchantTradeDailyService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -13,6 +13,10 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| @RestController | |||
| @RequestMapping("wxMerchantTradeDaily") | |||
| public class WxMerchantTradeDailyController extends BaseController { | |||
| @@ -21,46 +25,39 @@ public class WxMerchantTradeDailyController extends BaseController { | |||
| @Autowired | |||
| private WxMerchantTradeDailyService wxMerchantTradeDailyService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiOperation("获得昨日解单列表") | |||
| @GetMapping("/listYesterday") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMerchantTradeDaily wxMerchantTradeDaily, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchantTradeDaily) wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| final PageInfo<WxMerchantTradeDaily> page = wxMerchantTradeDailyService.listAsPage(wxMerchantTradeDaily, pageNum, pageSize); | |||
| public ResultData listYesterday(@ModelAttribute WxMerchantTradeDailyVo wxMerchantTradeDaily, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listYesterday"); | |||
| if (wxMerchantTradeDaily == null) wxMerchantTradeDaily = new WxMerchantTradeDailyVo(); | |||
| wxMerchantTradeDaily.setTenantId(getTenantId()); | |||
| Calendar cal = Calendar.getInstance(); | |||
| cal.setTime(new Date()); | |||
| cal.add(Calendar.DAY_OF_YEAR, -1); | |||
| SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd"); | |||
| wxMerchantTradeDaily.setReportDate(fmt.format(cal.getTime())); | |||
| wxMerchantTradeDaily.setSortColumns(WxMerchantTradeDailyVo.Field.CreateDate_DESC); | |||
| final PageInfo<WxMerchantTradeDailyVo> page = wxMerchantTradeDailyService.listAsPageVo(wxMerchantTradeDaily, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMerchantTradeDaily wxMerchantTradeDaily) { | |||
| //Assert.notNull(wxMerchantTradeDaily.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMerchantTradeDailyService.saveOrUpdate(wxMerchantTradeDaily); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMerchantTradeDaily wxMerchantTradeDaily) { | |||
| wxMerchantTradeDailyService.saveOrUpdate(wxMerchantTradeDaily); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMerchantTradeDailyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| @ApiOperation("获得近30日解单") | |||
| @GetMapping("/detail") | |||
| public ResultData detail(Long merchantId) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::detail"); | |||
| return wxMerchantTradeDailyService.getVolumeOfMonth(merchantId); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantTradeDailyService.getById(id)); | |||
| @ApiOperation("获得昨日解单列表") | |||
| @GetMapping("/listMonth") | |||
| public ResultData listMonth() { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listMonth"); | |||
| return wxMerchantTradeDailyService.getVolumeTotalOfMonth(getTenantId()); | |||
| } | |||
| @@ -29,6 +29,7 @@ public class WxMsgCallbackController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgCallback wxMsgCallback, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::list"); | |||
| if (null == wxMsgCallback) wxMsgCallback = new WxMsgCallback(); | |||
| wxMsgCallback.setTenantId(getTenantId()); | |||
| wxMsgCallback.setSortColumns(WxMsgCallback.Field.Createtime_DESC); | |||
| @@ -39,6 +40,7 @@ public class WxMsgCallbackController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgCallback wxMsgCallback) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::add"); | |||
| //Assert.notNull(wxMsgCallback.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgCallback.setTenantId(getTenantId()); | |||
| @@ -49,6 +51,7 @@ public class WxMsgCallbackController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsgCallback wxMsgCallback) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::update"); | |||
| wxMsgCallbackService.saveOrUpdate(wxMsgCallback); | |||
| return new ResultData(); | |||
| } | |||
| @@ -57,6 +60,7 @@ public class WxMsgCallbackController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::delete"); | |||
| wxMsgCallbackService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -65,12 +69,14 @@ public class WxMsgCallbackController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgCallbackService.getById(id)); | |||
| } | |||
| @PostMapping(value = "/receivemsg/{tenantId}") | |||
| public void receivemsg(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemsg"); | |||
| logger.info(param.toString()); | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.saveOrUpdate(tenantId,param); | |||
| @@ -79,6 +85,7 @@ public class WxMsgCallbackController extends BaseController { | |||
| @RequestMapping(value = "/receivemodel/{tenantId}") | |||
| public void receivemodel(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemodel"); | |||
| logger.info(param.toString()); | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receivemodel(tenantId, param); | |||
| @@ -87,6 +94,7 @@ public class WxMsgCallbackController extends BaseController { | |||
| @RequestMapping(value = "/receiveverifymodel/{tenantId}") | |||
| public void receiveverifymodel(@PathVariable String tenantId, @RequestParam Map<String, String> param) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receiveverifymodel"); | |||
| logger.info(param.toString()); | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receiveverifymodel(tenantId, param); | |||
| @@ -27,6 +27,7 @@ public class WxMsgConfigController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgConfig wxMsgConfig, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgConfigController::list"); | |||
| if (null == wxMsgConfig) wxMsgConfig = new WxMsgConfig(); | |||
| final PageInfo<WxMsgConfig> page = wxMsgConfigService.listAsPage(wxMsgConfig, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxMsgConfigController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgConfig wxMsgConfig) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgConfigController::add"); | |||
| //Assert.notNull(wxMsgConfig.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgConfigService.saveOrUpdate(wxMsgConfig); | |||
| @@ -44,6 +46,7 @@ public class WxMsgConfigController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsgConfig wxMsgConfig) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgConfigController::update"); | |||
| wxMsgConfigService.saveOrUpdate(wxMsgConfig); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxMsgConfigController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgConfigController::delete"); | |||
| wxMsgConfigService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxMsgConfigController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgConfigController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgConfigService.getById(id)); | |||
| } | |||
| @@ -1,11 +1,22 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.PushLimit; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxMsg; | |||
| import com.iformall.domain.po.WxMsgConfig; | |||
| import com.iformall.enums.EnumMsgSend; | |||
| import com.iformall.enums.EnumMsgStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxMsgConfigMapper; | |||
| import com.iformall.service.PushLimitService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxMsgService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -18,8 +29,11 @@ import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.util.UUID; | |||
| import java.util.*; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxMsg") | |||
| public class WxMsgController extends BaseController { | |||
| @@ -28,12 +42,22 @@ public class WxMsgController extends BaseController { | |||
| @Autowired | |||
| private WxMsgService wxMsgService; | |||
| @Autowired | |||
| WxMsgConfigMapper wxMsgConfigMapper; | |||
| @Autowired | |||
| WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| PushLimitService pushLimitService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsg wxMsg, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::list"); | |||
| if (null == wxMsg) wxMsg = new WxMsg(); | |||
| wxMsg.setTenantId(getTenantId()); | |||
| //wxMsg.setWay(EnumSendWay.TAG.getCode()); | |||
| @@ -45,23 +69,105 @@ public class WxMsgController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsg wxMsg) { | |||
| //Assert.notNull(wxMsg.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::add"); | |||
| //不是草稿检验疲劳度 | |||
| if (!wxMsg.getStatus().equals(EnumMsgStatus.MSG_STATUS_DRAFT.getCode())) { | |||
| if (wxMsg.getIsright().equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) { | |||
| try { | |||
| pushLimitService.checkSendTime(getTenantId()); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| } else { | |||
| PushLimit pushLimit = pushLimitService.getPushLimit(getTenantId()); | |||
| String sendtime = wxMsg.getSendtime(); | |||
| Date date = DateUtils.stringToDate(sendtime, "yyyy-MM-dd HH:mm:ss"); | |||
| boolean isInDate = DateUtils.isInDate(date, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); | |||
| if (!isInDate) { | |||
| return new ResultData(ErrorCode.PUSH_LIMIT_NOT_INRANG); | |||
| } | |||
| } | |||
| if(wxMsg.getId()!=null){ | |||
| //如果不是草稿必然之前状态是草稿,删除 | |||
| wxMsgService.deleteById(wxMsg.getId()); | |||
| } | |||
| } | |||
| wxMsg.setTenantId(getTenantId()); | |||
| return wxMsgService.saveOrUpdate(wxMsg); | |||
| } | |||
| //1、手机多条以逗号分隔,直接通过实体得到wxmsg.getphones | |||
| //2、通过标签 | |||
| String phones = wxMsg.getPhones(); | |||
| String label = wxMsg.getLabel(); | |||
| if (!phones.equals("") && !label.equals("")) {//两种方式只能选其一 | |||
| return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); | |||
| } | |||
| if (phones.equals("")) {//没有手工输入手机号时解析标签,有,继续流转 | |||
| phones = parselabel(wxMsg.getTenantId(), wxMsg); | |||
| if (phones.equals("")) {//解析之后手机号依然不存在时返回 | |||
| return new ResultData(ErrorCode.MSG_PHONE_NOT_FOUND); | |||
| } | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsg wxMsg) { | |||
| wxMsgService.saveOrUpdate(wxMsg); | |||
| //保证手机号惟一 | |||
| String[] phoneSplit = phones.split(","); | |||
| Set<String> phoneSet = new HashSet<>(); | |||
| for (String phone : phoneSplit) { | |||
| phoneSet.add(phone); | |||
| } | |||
| wxMsg.setExpectSendNumber(phoneSet.size());//预计发送数量 | |||
| StringBuffer sb = new StringBuffer(); | |||
| for (String phone : phoneSet) { | |||
| sb.append(phone).append(","); | |||
| } | |||
| wxMsg.setPhones(sb.deleteCharAt(sb.length() - 1).toString()); | |||
| //从短信配置中查询密钥 bid 等信息 | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(wxMsg.getTenantId()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if (wxMsgConfigs.size() == 0) return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND, "您还未接入短信运营商,请联系平台管理员"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| if (wxMsgConfig.getRemains() == 0) { | |||
| logger.info("短信数量为0"); | |||
| return new ResultData(ErrorCode.MSG_SUM_ZERO); | |||
| } | |||
| if (wxMsgConfig.getRemains() < wxMsg.getExpectSendNumber()) { | |||
| logger.info("短信数量不足"); | |||
| return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT); | |||
| } | |||
| wxMsgService.saveOrUpdate(wxMsg, wxMsgConfig); | |||
| return new ResultData(); | |||
| } | |||
| private String parselabel(String tenantId, WxMsg wxmsg) { | |||
| String label = wxmsg.getLabel(); | |||
| String[] arys = label.split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| List<WxCUserBasicInfo> list = wxCUserTagsService.findByTag(tenantId, tagids); | |||
| StringBuilder sb = new StringBuilder(); | |||
| if (list.size() > 0) { | |||
| for (WxCUserBasicInfo cUserInfo : list) { | |||
| sb.append(cUserInfo.getPhone()).append(","); | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| return ""; | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::delete"); | |||
| wxMsgService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -70,12 +176,24 @@ public class WxMsgController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgService.getById(id)); | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::findById"); | |||
| WxMsg wxMsg = wxMsgService.getById(id); | |||
| String label = wxMsg.getLabel(); | |||
| if (label != null && !label.isEmpty()) { | |||
| String[] arys = label.split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| wxMsg.setTagsList(wxCUserTagsService.findTagList(getTenantId(), tagids)); | |||
| } | |||
| return new ResultData(wxMsg); | |||
| } | |||
| @RequestMapping("/excleupload") | |||
| public ResultData excleupload(@RequestParam("file") MultipartFile file) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::excleupload"); | |||
| if (file.isEmpty()) { | |||
| return new ResultData(Result.SUCCESS, "上传文件不能为空"); | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxMsgModelController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgModel wxMsgModel, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgModelController::list"); | |||
| if (null == wxMsgModel) wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setTenantId(getTenantId()); | |||
| wxMsgModel.setSortColumns(WxMsgModel.Field.Createtime_DESC); | |||
| @@ -37,6 +38,7 @@ public class WxMsgModelController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgModel wxMsgModel) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgModelController::add"); | |||
| //Assert.notNull(wxMsgModel.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgModel.setTenantId(getTenantId()); | |||
| @@ -47,6 +49,7 @@ public class WxMsgModelController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsgModel wxMsgModel) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgModelController::update"); | |||
| return wxMsgModelService.saveOrUpdate(wxMsgModel); | |||
| } | |||
| @@ -54,6 +57,7 @@ public class WxMsgModelController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgModelController::delete"); | |||
| wxMsgModelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -62,12 +66,14 @@ public class WxMsgModelController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgModelController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgModelService.getById(id)); | |||
| } | |||
| @ApiOperation("获取所有数据") | |||
| @GetMapping("getmodellist") | |||
| public ResultData getmodellist() { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgModelController::getmodellist"); | |||
| return wxMsgModelService.getmodellist(getTenantId()); | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxMsgSignatureController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgSignature wxMsgSignature, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::list"); | |||
| if (null == wxMsgSignature) wxMsgSignature = new WxMsgSignature(); | |||
| wxMsgSignature.setTenantId(getTenantId()); | |||
| wxMsgSignature.setSortColumns(WxMsgSignature.Field.Createtime_DESC); | |||
| @@ -37,6 +38,7 @@ public class WxMsgSignatureController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgSignature wxMsgSignature) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::add"); | |||
| //Assert.notNull(wxMsgSignature.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgSignature.setTenantId(getTenantId()); | |||
| @@ -47,6 +49,7 @@ public class WxMsgSignatureController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsgSignature wxMsgSignature) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::update"); | |||
| wxMsgSignatureService.saveOrUpdate(wxMsgSignature); | |||
| return new ResultData(); | |||
| } | |||
| @@ -55,6 +58,7 @@ public class WxMsgSignatureController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::delete"); | |||
| wxMsgSignatureService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -63,12 +67,14 @@ public class WxMsgSignatureController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgSignatureService.getById(id)); | |||
| } | |||
| @ApiOperation("获取所有数据") | |||
| @GetMapping("getsignaturelist") | |||
| public ResultData getmodellist() { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::getmodellist"); | |||
| return wxMsgSignatureService.getsignaturelist(getTenantId()); | |||
| } | |||
| @@ -25,6 +25,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsgValidationcode wxMsgValidationcode,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::list"); | |||
| if (null == wxMsgValidationcode) wxMsgValidationcode = new WxMsgValidationcode(); | |||
| final PageInfo<WxMsgValidationcode> page = wxMsgValidationcodeService.listAsPage(wxMsgValidationcode, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -32,6 +33,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgValidationcode wxMsgValidationcode) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::add"); | |||
| //Assert.notNull(wxMsgValidationcode.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgValidationcodeService.saveOrUpdate(wxMsgValidationcode); | |||
| @@ -40,6 +42,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsgValidationcode wxMsgValidationcode) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::update"); | |||
| wxMsgValidationcodeService.saveOrUpdate(wxMsgValidationcode); | |||
| return new ResultData(); | |||
| } | |||
| @@ -47,13 +50,15 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::update"); | |||
| wxMsgValidationcodeService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgValidationcodeService.getById(id)); | |||
| } | |||
| @@ -66,6 +71,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @ApiImplicitParam(name="type",value="场景",dataType="Integer", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="appid",value="appid",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData sendvalidationcode(String tenantId,String phone,Integer type,String appid) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::sendvalidationcode"); | |||
| WxMsgValidationcode wxMsgValidationcode =new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(tenantId); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| @@ -82,6 +88,7 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @ApiImplicitParam(name="code",value="验证码",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="appid",value="appid",dataType="String", paramType = "query",required=true)}) | |||
| public ResultData hasvalidationcode(String tenantId,String phone,Integer type,String code,String appid) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::hasvalidationcode"); | |||
| WxMsgValidationcode wxMsgValidationcode =new WxMsgValidationcode(); | |||
| wxMsgValidationcode.setTenantId(tenantId); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| @@ -25,6 +25,7 @@ public class WxMsgValidationcodeModelController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgValidationcodeModel wxMsgValidationcodeModel, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeModelController::list"); | |||
| if (null == wxMsgValidationcodeModel) wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | |||
| wxMsgValidationcodeModel.setTenantId(getTenantId()); | |||
| final PageInfo<WxMsgValidationcodeModel> page = wxMsgValidationcodeModelService.listAsPage(wxMsgValidationcodeModel, pageNum, pageSize); | |||
| @@ -33,6 +34,7 @@ public class WxMsgValidationcodeModelController extends BaseController { | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgValidationcodeModel wxMsgValidationcodeModel) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeModelController::add"); | |||
| //Assert.notNull(wxMsgValidationcodeModel.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgValidationcodeModel.setTenantId(getTenantId()); | |||
| @@ -41,6 +43,7 @@ public class WxMsgValidationcodeModelController extends BaseController { | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxMsgValidationcodeModel wxMsgValidationcodeModel) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeModelController::update"); | |||
| wxMsgValidationcodeModelService.saveOrUpdate(wxMsgValidationcodeModel); | |||
| return new ResultData(); | |||
| } | |||
| @@ -48,6 +51,7 @@ public class WxMsgValidationcodeModelController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeModelController::delete"); | |||
| wxMsgValidationcodeModelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -55,6 +59,7 @@ public class WxMsgValidationcodeModelController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findById(String id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeModelController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgValidationcodeModelService.getById(id)); | |||
| } | |||
| @@ -28,9 +28,10 @@ public class WxOrderController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", defaultValue = "0", required = false, dataType = "Integer") | |||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", defaultValue = "0", required = false, dataType = "int") | |||
| }) | |||
| public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxOrderController::list"); | |||
| if (null == wxOrder) wxOrder = new WxOrder(); | |||
| wxOrder.setTenantId(getTenantId()); | |||
| wxOrder.setSortColumns(WxOrder.Field.Id_DESC); | |||
| @@ -41,6 +42,7 @@ public class WxOrderController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxOrder wxOrder) { | |||
| logger.debug("[" + getIpAddr() + "] WxOrderController::add"); | |||
| //Assert.notNull(wxOrder.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxOrderService.saveOrUpdate(wxOrder); | |||
| @@ -50,6 +52,7 @@ public class WxOrderController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxOrder wxOrder) { | |||
| logger.debug("[" + getIpAddr() + "] WxOrderController::update"); | |||
| wxOrderService.saveOrUpdate(wxOrder); | |||
| return new ResultData(); | |||
| } | |||
| @@ -58,6 +61,7 @@ public class WxOrderController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxOrderController::delete"); | |||
| wxOrderService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -66,7 +70,8 @@ public class WxOrderController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxOrderService.getById(id)); | |||
| logger.debug("[" + getIpAddr() + "] WxOrderController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxOrderService.getById(id)); | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxParkController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxPark wxPark, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxParkController::list"); | |||
| if (null == wxPark) wxPark = new WxPark(); | |||
| final PageInfo<WxPark> page = wxParkService.listAsPage(wxPark, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxParkController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxPark wxPark) { | |||
| logger.debug("[" + getIpAddr() + "] WxParkController::add"); | |||
| //Assert.notNull(wxPark.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxParkService.saveOrUpdate(wxPark); | |||
| @@ -44,6 +46,7 @@ public class WxParkController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxPark wxPark) { | |||
| logger.debug("[" + getIpAddr() + "] WxParkController::update"); | |||
| wxParkService.saveOrUpdate(wxPark); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxParkController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxParkController::delete"); | |||
| wxParkService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxParkController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxParkController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxParkService.getById(id)); | |||
| } | |||
| @@ -29,6 +29,7 @@ public class WxPayAccountController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxPayAccount wxPayAccount,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayAccountController::list"); | |||
| if (null == wxPayAccount) wxPayAccount = new WxPayAccount(); | |||
| final PageInfo<WxPayAccount> page = wxPayAccountService.listAsPage(wxPayAccount, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -37,6 +38,7 @@ public class WxPayAccountController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxPayAccount wxPayAccount) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayAccountController::add"); | |||
| //Assert.notNull(wxPayAccount.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxPayAccountService.saveOrUpdate(wxPayAccount); | |||
| @@ -46,6 +48,7 @@ public class WxPayAccountController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxPayAccount wxPayAccount) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayAccountController::update"); | |||
| wxPayAccountService.saveOrUpdate(wxPayAccount); | |||
| return new ResultData(); | |||
| } | |||
| @@ -54,14 +57,16 @@ public class WxPayAccountController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayAccountController::delete"); | |||
| wxPayAccountService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayAccountController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxPayAccountService.getById(id)); | |||
| } | |||
| @@ -0,0 +1,185 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.exception.BizMessageException; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.pay.WxPayment; | |||
| import com.iformall.service.WxPayBillService; | |||
| import com.iformall.service.WxRefundOrderService; | |||
| import com.iformall.utils.XmlUtil; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.jdom2.JDOMException; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.http.MediaType; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.ResponseBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.nio.charset.Charset; | |||
| import java.util.Map; | |||
| import java.util.SortedMap; | |||
| import java.util.TreeMap; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/wxPayBill/notify") | |||
| public class WxPayBillController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxPayBillService wxPayBillService; | |||
| @Autowired | |||
| private WxRefundOrderService wxRefundOrderService; | |||
| /** | |||
| * | |||
| * @return 接收微信异步通知 | |||
| * @throws Exception 可能产生的任何异常 | |||
| */ | |||
| @RequestMapping(value = "/pay", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) | |||
| @ResponseBody | |||
| public String _payNotify(HttpServletRequest request) throws IOException, JDOMException { | |||
| logger.info("[" +getIpAddr() + "]微信支付回调Bill"); | |||
| InputStream inStream = request.getInputStream(); | |||
| ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); | |||
| byte[] buffer = new byte[1024]; | |||
| int len = 0; | |||
| while ((len = inStream.read(buffer)) != -1) { | |||
| outSteam.write(buffer, 0, len); | |||
| } | |||
| String resultxml = new String(outSteam.toByteArray(), Charset.forName("UTF-8")); | |||
| logger.info(resultxml); | |||
| outSteam.close(); | |||
| inStream.close(); | |||
| Map<String, String> paramMap = null; | |||
| try { | |||
| paramMap = WxPayment.xmlToMap(resultxml); | |||
| logger.info("微信支付回调, notify, param: " + paramMap.toString() ); | |||
| String response = wxPayBillService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| logger.info("微信支付回调, notify success, req : " + resultxml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| if (paramMap == null) { | |||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("微信支付回调, order create error, req: " + resultxml + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap<>(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| if (paramMap == null) { | |||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("微信支付回调, order create error, req: " + resultxml + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap<>(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| if (paramMap == null) { | |||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||
| } else { | |||
| logger.error("微信支付回调, order create error, req: " + resultxml + ", e: " + e.getMessage()); | |||
| } | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } | |||
| /** | |||
| * | |||
| * @return 接收微信退款异步通知 | |||
| * @throws Exception 可能产生的任何异常 | |||
| */ | |||
| @RequestMapping(value = "/refund") | |||
| public String __refundNotify(HttpServletRequest request) throws Exception { | |||
| logger.info("[" +getIpAddr() + "]微信退款回调Bill"); | |||
| Map<String, String> paramMap = null; | |||
| String response = ""; | |||
| String xml = ""; | |||
| try { | |||
| xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| logger.info(xml); | |||
| paramMap = WxPayment.xmlToMap(xml); | |||
| response = wxRefundOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| logger.info("refund wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" +e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("refund wxpay, order create error, req: " + xml + ", e: " + e.getMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } | |||
| /** | |||
| * | |||
| * @return 接收微信分账异步通知 | |||
| * @throws Exception 可能产生的任何异常 | |||
| */ | |||
| @RequestMapping(value = "/sharing") | |||
| public String __shareNotify(HttpServletRequest request) throws Exception { | |||
| logger.info("[" +getIpAddr() + "]微信分账回调Bill"); | |||
| Map<String, String> paramMap = null; | |||
| String response = ""; | |||
| String xml = ""; | |||
| try { | |||
| xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||
| paramMap = WxPayment.xmlToMap(xml); | |||
| logger.info("share wxpay, notify, param: " + xml ); | |||
| response = wxPayBillService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||
| logger.info("share wxpay, notify success, req : " + xml + ", resp: " + response.toString()); | |||
| return response; | |||
| } catch (BizMessageException e) { | |||
| logger.error("share wxpay, notify error, req: " + xml + ", e:" + e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (MallinkException e) { | |||
| logger.error("refund wxpay, notify error, req: " + xml + ", e:" +e.getLocalizedMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } catch (Exception e) { | |||
| logger.error("refund wxpay, order create error, req: " + xml + ", e: " + e.getMessage()); | |||
| SortedMap resultMap = new TreeMap(); | |||
| resultMap.put("return_code", "FAIL"); | |||
| resultMap.put("return_msg", e.getMessage()); | |||
| return XmlUtil.getRequestXml(resultMap); | |||
| } | |||
| } | |||
| } | |||
| @@ -9,7 +9,7 @@ import com.iformall.service.WxProfitSharingOrderService; | |||
| import com.iformall.service.WxRefundOrderService; | |||
| import com.iformall.utils.XmlUtil; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.jdom.JDOMException; | |||
| import org.jdom2.JDOMException; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.http.MediaType; | |||
| @@ -36,10 +36,6 @@ public class WxPayController extends BaseController { | |||
| @Autowired | |||
| private WxRefundOrderService wxRefundOrderService; | |||
| @Autowired | |||
| private WxProfitSharingOrderService wxProfitSharingOrderService; | |||
| /** | |||
| * | |||
| * @return 接收微信异步通知 | |||
| @@ -48,7 +44,7 @@ public class WxPayController extends BaseController { | |||
| @RequestMapping(value = "/pay", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) | |||
| @ResponseBody | |||
| public String _payNotify(HttpServletRequest request) throws IOException, JDOMException { | |||
| logger.info("微信支付回调"); | |||
| logger.info("[" +getIpAddr() + "]微信支付回调"); | |||
| InputStream inStream = request.getInputStream(); | |||
| ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); | |||
| byte[] buffer = new byte[1024]; | |||
| @@ -111,6 +107,7 @@ public class WxPayController extends BaseController { | |||
| */ | |||
| @RequestMapping(value = "/refund") | |||
| public String __refundNotify(HttpServletRequest request) throws Exception { | |||
| logger.info("[" +getIpAddr() + "]微信退款回调"); | |||
| Map<String, String> paramMap = null; | |||
| String response = ""; | |||
| String xml = ""; | |||
| @@ -149,6 +146,7 @@ public class WxPayController extends BaseController { | |||
| */ | |||
| @RequestMapping(value = "/sharing") | |||
| public String __shareNotify(HttpServletRequest request) throws Exception { | |||
| logger.info("[" +getIpAddr() + "]微信分账回调"); | |||
| Map<String, String> paramMap = null; | |||
| String response = ""; | |||
| String xml = ""; | |||
| @@ -25,6 +25,12 @@ public class WxPayOrderController extends BaseController { | |||
| @Autowired | |||
| private WxPayOrderService wxPayOrderService; | |||
| @Autowired | |||
| private WxProfitSharingOrderService xProfitSharingOrderService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -32,6 +38,7 @@ public class WxPayOrderController extends BaseController { | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxPayOrder wxPayOrder,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayOrderController::list"); | |||
| if (null == wxPayOrder) wxPayOrder = new WxPayOrder(); | |||
| final PageInfo<WxPayOrder> page = wxPayOrderService.listAsPage(wxPayOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -40,6 +47,7 @@ public class WxPayOrderController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxPayOrder wxPayOrder) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayOrderController::add"); | |||
| //Assert.notNull(wxPayOrder.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxPayOrderService.saveOrUpdate(wxPayOrder); | |||
| @@ -49,30 +57,25 @@ public class WxPayOrderController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxPayOrder wxPayOrder) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayOrderController::update"); | |||
| wxPayOrderService.saveOrUpdate(wxPayOrder); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxPayOrderController::delete"); | |||
| wxPayOrderService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxPayOrderService.getById(id)); | |||
| logger.debug("[" + getIpAddr() + "] WxPayOrderController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxPayOrderService.getById(id)); | |||
| } | |||
| @Autowired | |||
| private WxProfitSharingOrderService xProfitSharingOrderService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| } | |||
| @@ -31,6 +31,7 @@ public class WxProfitSharingReceiverController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxProfitSharingReceiver receiver, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingReceiverController::list"); | |||
| if (null == receiver) receiver = new WxProfitSharingReceiver(); | |||
| final PageInfo<WxProfitSharingReceiver> page = wxProfitSharingReceiverService.listAsPage(receiver, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -40,6 +41,7 @@ public class WxProfitSharingReceiverController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@ModelAttribute WxProfitSharingReceiver receiver) { | |||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingReceiverController::add"); | |||
| if (receiver == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| @@ -65,6 +67,7 @@ public class WxProfitSharingReceiverController extends BaseController { | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("del") | |||
| public ResultData delete(@ModelAttribute WxProfitSharingReceiver receiver) { | |||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingReceiverController::delete"); | |||
| if (receiver == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| if (receiver.getMerchantId() == null) | |||
| @@ -0,0 +1,112 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxPropertyContract; | |||
| import com.iformall.service.WxPropertyContractService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxPropertyContract") | |||
| public class WxPropertyContractController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxPropertyContractService wxPropertyContractService; | |||
| private Logger logger = LoggerFactory.getLogger(WxPropertyContractController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxPropertyContract wxPropertyContract,Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::list"); | |||
| if (null == wxPropertyContract){ | |||
| wxPropertyContract = new WxPropertyContract(); | |||
| } | |||
| wxPropertyContract.setTenantId(getTenantId()); | |||
| Map<String, Object> result = wxPropertyContractService.listAsPage(wxPropertyContract, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); | |||
| wxPropertyContract.setTenantId(getTenantId()); | |||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); | |||
| wxPropertyContract.setTenantId(getTenantId()); | |||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::delete"); | |||
| wxPropertyContractService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::findById"); | |||
| return wxPropertyContractService.getById(id); | |||
| } | |||
| @RequestMapping("/download") | |||
| public void download(HttpServletRequest request, HttpServletResponse response){ | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::download"); | |||
| wxPropertyContractService.download(request,response,getTenantId()); | |||
| } | |||
| @GetMapping("/getPropertyContractStatusInfo") | |||
| public ResultData getPropertyContractStatusInfo() { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getPropertyContractStatusInfo"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractStatusInfo(getTenantId())); | |||
| } | |||
| @GetMapping("/endPropertyContract") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData endRentContract(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endRentContract"); | |||
| return wxPropertyContractService.endRentContract(id); | |||
| } | |||
| @GetMapping("/getRentContractList") | |||
| public ResultData getRentContractList() { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::getRentContractList"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxPropertyContractService.getRentContractList(getTenantId())); | |||
| } | |||
| @GetMapping("/endPropertyContractByRentContractId") | |||
| @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData endPropertyContractByRentContractId(Long rentContractId) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::endPropertyContractByRentContractId"); | |||
| return wxPropertyContractService.endPropertyContractByRentContractId(rentContractId); | |||
| } | |||
| @GetMapping("/hasRentContract") | |||
| @ApiImplicitParam(name = "rentContractId", value = "rentContractId", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData hasRentContract(Long rentContractId) { | |||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::hasRentContract"); | |||
| return wxPropertyContractService.hasRentContract(rentContractId); | |||
| } | |||
| } | |||
| @@ -0,0 +1,83 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxQuestion; | |||
| import com.iformall.domain.po.WxQuestionConfig; | |||
| import com.iformall.enums.EnumQuestionConfigStatus; | |||
| import com.iformall.service.*; | |||
| 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 java.util.ArrayList; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxQuestion") | |||
| @Api(description="问券调查") | |||
| public class WxQuestionController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxQuestionService wxQuestionService; | |||
| @ApiOperation("查寻问券配置") | |||
| @GetMapping("getConfig") | |||
| public Result getQuestionConfig() { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionController::getQuestionConfig"); | |||
| WxQuestionConfig wxQuestionConfig = new WxQuestionConfig(); | |||
| WxQuestion wxQuestion = new WxQuestion(); | |||
| wxQuestionConfig.setTenantId(getTenantId()); | |||
| wxQuestion.setTenantId(getTenantId()); | |||
| List<WxQuestionConfig> list = wxQuestionService.findConfigList(wxQuestionConfig); | |||
| if (list.size() > 0) { | |||
| list.get(0).setQuestions(wxQuestionService.findList(wxQuestion)); | |||
| return new ResultData(list.get(0)); | |||
| } | |||
| wxQuestionConfig.setQuestions(wxQuestionService.findList(wxQuestion)); | |||
| wxQuestionConfig.setQuestionList(""); | |||
| wxQuestionConfig.setCouponTypeList(""); | |||
| wxQuestionConfig.setStatus(EnumQuestionConfigStatus.OFF.getCode()); | |||
| return new ResultData(wxQuestionConfig); | |||
| } | |||
| @ApiOperation("设置问券配置") | |||
| @PostMapping("setConfig") | |||
| public Result setQuestionConfig(@RequestBody WxQuestionConfig wxQuestionConfig) { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionController::setQuestionConfig"); | |||
| if (wxQuestionConfig == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| if (wxQuestionConfig.getQuestionList() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| if (wxQuestionConfig.getCouponTypeList() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| String[] arys1 = wxQuestionConfig.getQuestionList().split(","); | |||
| List<Long> qs = new ArrayList<>(); | |||
| for (int i = 0; i < arys1.length; i++) { | |||
| if (!arys1[i].isEmpty()) | |||
| qs.add(Long.parseLong(arys1[i])); | |||
| } | |||
| String[] arys2 = wxQuestionConfig.getCouponTypeList().split(","); | |||
| List<Long> ct = new ArrayList<>(); | |||
| for (int i = 0; i < arys2.length; i++) { | |||
| if (!arys2[i].isEmpty()) | |||
| ct.add(Long.parseLong(arys2[i])); | |||
| } | |||
| wxQuestionConfig.setQuestionList(JSONObject.toJSONString(qs)); | |||
| wxQuestionConfig.setCouponTypeList(JSONObject.toJSONString(ct)); | |||
| wxQuestionConfig.setTenantId(getTenantId()); | |||
| wxQuestionService.saveOrUpdateConfig(wxQuestionConfig); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -30,6 +30,7 @@ public class WxRefundOrderController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxRefundOrder wxRefundOrder, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxRefundOrderController::list"); | |||
| if (null == wxRefundOrder) wxRefundOrder = new WxRefundOrder(); | |||
| final PageInfo<WxRefundOrder> page = wxRefundOrderService.listAsPage(wxRefundOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -38,6 +39,7 @@ public class WxRefundOrderController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxRefundOrder wxRefundOrder) { | |||
| logger.debug("[" + getIpAddr() + "] WxRefundOrderController::add"); | |||
| //Assert.notNull(wxRefundOrder.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxRefundOrderService.saveOrUpdate(wxRefundOrder); | |||
| @@ -47,6 +49,7 @@ public class WxRefundOrderController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxRefundOrder wxRefundOrder) { | |||
| logger.debug("[" + getIpAddr() + "] WxRefundOrderController::update"); | |||
| wxRefundOrderService.saveOrUpdate(wxRefundOrder); | |||
| return new ResultData(); | |||
| } | |||
| @@ -55,6 +58,7 @@ public class WxRefundOrderController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxRefundOrderController::delete"); | |||
| wxRefundOrderService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -63,6 +67,7 @@ public class WxRefundOrderController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxRefundOrderController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxRefundOrderService.getById(id)); | |||
| } | |||
| @@ -1,6 +1,5 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| @@ -12,51 +11,98 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxRentContract") | |||
| public class WxRentContractController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @Autowired | |||
| private WxRentContractService wxRentContractService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxRentContract wxRentContract,Integer pageNum, Integer pageSize) { | |||
| if (null == wxRentContract) wxRentContract = new WxRentContract(); | |||
| final PageInfo<WxRentContract> page = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxRentContract wxRentContract, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::list"); | |||
| if (null == wxRentContract) { | |||
| wxRentContract = new WxRentContract(); | |||
| } | |||
| wxRentContract.setTenantId(getTenantId()); | |||
| Map<String, Object> result = wxRentContractService.listAsPage(wxRentContract, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxRentContract wxRentContract) { | |||
| //Assert.notNull(wxRentContract.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxRentContractService.saveOrUpdate(wxRentContract); | |||
| return new ResultData(); | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); | |||
| wxRentContract.setTenantId(getTenantId()); | |||
| return wxRentContractService.saveOrUpdate(wxRentContract); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxRentContract wxRentContract) { | |||
| wxRentContractService.saveOrUpdate(wxRentContract); | |||
| return new ResultData(); | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | |||
| wxRentContract.setTenantId(getTenantId()); | |||
| return wxRentContractService.saveOrUpdate(wxRentContract); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| wxRentContractService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| public ResultData findById(String id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxRentContractService.getById(id)); | |||
| } | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::delete"); | |||
| return wxRentContractService.deleteById(id); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::findById"); | |||
| return wxRentContractService.getById(id); | |||
| } | |||
| @RequestMapping("/download") | |||
| public void download(HttpServletRequest request, HttpServletResponse response){ | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::download"); | |||
| wxRentContractService.download(request,response,getTenantId()); | |||
| } | |||
| @GetMapping("/getRentContractStatusInfo") | |||
| public ResultData getRentContractStatusInfo() { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractStatusInfo"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getRentContractStatusInfo(getTenantId())); | |||
| } | |||
| @GetMapping("/endRentContract") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "status", value = "status", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData endRentContract(Long id,Integer status) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::endRentContract"); | |||
| return wxRentContractService.endRentContract(id,status); | |||
| } | |||
| @PostMapping("updateMerchant") | |||
| public ResultData updateMerchant(@RequestBody WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMerchant"); | |||
| return wxRentContractService.updateMerchant(wxRentContract); | |||
| } | |||
| @GetMapping("getRentContractList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData getRentContractList(Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::getRentContractList"); | |||
| return new ResultData(wxRentContractService.getRentContractList(getTenantId(),pageNum, pageSize)); | |||
| } | |||
| } | |||
| @@ -27,6 +27,7 @@ public class WxScoreHistoryController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxScoreHistory wxScoreHistory, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::list"); | |||
| if (null == wxScoreHistory) wxScoreHistory = new WxScoreHistory(); | |||
| final PageInfo<WxScoreHistory> page = wxScoreHistoryService.listAsPage(wxScoreHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxScoreHistoryController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxScoreHistory wxScoreHistory) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::add"); | |||
| //Assert.notNull(wxScoreHistory.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | |||
| @@ -44,6 +46,7 @@ public class WxScoreHistoryController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxScoreHistory wxScoreHistory) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::update"); | |||
| wxScoreHistoryService.saveOrUpdate(wxScoreHistory); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxScoreHistoryController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::delete"); | |||
| wxScoreHistoryService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxScoreHistoryController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreHistoryService.getById(id)); | |||
| } | |||
| @@ -26,6 +26,7 @@ public class WxScoreRulesController extends BaseController { | |||
| @ApiOperation("成长值配置") | |||
| @GetMapping("setting") | |||
| public ResultData list() { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getTenantId()); | |||
| return new ResultData(scoreRules); | |||
| } | |||
| @@ -33,6 +34,7 @@ public class WxScoreRulesController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::add"); | |||
| wxScoreRules.setTenantId(getTenantId()); | |||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | |||
| return new ResultData(); | |||
| @@ -27,6 +27,7 @@ public class WxScoreValidityPeriodController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxScoreValidityPeriod wxScoreValidityPeriod, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreValidityPeriodController::list"); | |||
| if (null == wxScoreValidityPeriod) wxScoreValidityPeriod = new WxScoreValidityPeriod(); | |||
| final PageInfo<WxScoreValidityPeriod> page = wxScoreValidityPeriodService.listAsPage(wxScoreValidityPeriod, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -35,6 +36,7 @@ public class WxScoreValidityPeriodController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxScoreValidityPeriod wxScoreValidityPeriod) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreValidityPeriodController::add"); | |||
| //Assert.notNull(wxScoreValidityPeriod.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxScoreValidityPeriodService.saveOrUpdate(wxScoreValidityPeriod); | |||
| @@ -44,6 +46,7 @@ public class WxScoreValidityPeriodController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxScoreValidityPeriod wxScoreValidityPeriod) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreValidityPeriodController::update"); | |||
| wxScoreValidityPeriodService.saveOrUpdate(wxScoreValidityPeriod); | |||
| return new ResultData(); | |||
| } | |||
| @@ -52,6 +55,7 @@ public class WxScoreValidityPeriodController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreValidityPeriodController::delete"); | |||
| wxScoreValidityPeriodService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -60,6 +64,7 @@ public class WxScoreValidityPeriodController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreValidityPeriodController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreValidityPeriodService.getById(id)); | |||
| } | |||
| @@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxShop") | |||
| public class WxShopController extends BaseController { | |||
| @@ -29,7 +32,10 @@ public class WxShopController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxShop wxShop, Integer pageNum, Integer pageSize) { | |||
| if (null == wxShop) wxShop = new WxShop(); | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::list"); | |||
| if (null == wxShop){ | |||
| wxShop = new WxShop(); | |||
| } | |||
| wxShop.setTenantId(getTenantId()); | |||
| wxShop.setSortColumns(WxShop.Field.Id_DESC); | |||
| @@ -40,24 +46,23 @@ public class WxShopController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxShop wxShop) { | |||
| //Assert.notNull(wxShop.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::add"); | |||
| wxShop.setTenantId(getTenantId()); | |||
| wxShopService.saveOrUpdate(wxShop); | |||
| return new ResultData(); | |||
| return wxShopService.saveOrUpdate(wxShop); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxShop wxShop) { | |||
| wxShopService.saveOrUpdate(wxShop); | |||
| return new ResultData(); | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::update"); | |||
| return wxShopService.saveOrUpdate(wxShop); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::delete"); | |||
| wxShopService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -66,6 +71,7 @@ public class WxShopController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxShopService.getById(id)); | |||
| } | |||
| @@ -73,6 +79,7 @@ public class WxShopController extends BaseController { | |||
| @GetMapping("getShopListByShopNumber") | |||
| @ApiImplicitParam(name = "shopNumber", value = "shopNumber", dataType = "String", paramType = "query", required = true) | |||
| public ResultData getbshoplist(String shopNumber) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::getbshoplist"); | |||
| return wxShopService.getbshoplist(getTenantId(), shopNumber); | |||
| } | |||
| @@ -80,19 +87,35 @@ public class WxShopController extends BaseController { | |||
| @GetMapping("getMerchantShopByShopId") | |||
| @ApiImplicitParam(name = "shopId", value = "shopId", dataType = "String", paramType = "query", required = true) | |||
| public ResultData getMerchantShopByShopId(String shopId) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::getMerchantShopByShopId"); | |||
| return wxShopService.getMerchantShopByShopId(getTenantId(), shopId); | |||
| } | |||
| @ApiOperation("查询商铺号是否存在") | |||
| @GetMapping("hasShopNumber") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "shopNumber", value = "shopNumber", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query")}) | |||
| public ResultData hasShopNumber(String shopNumber,Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::hasShopNumber"); | |||
| return wxShopService.hasShopNumber(getTenantId(), shopNumber,id); | |||
| } | |||
| @ApiOperation("分页列表接品-合同访问") | |||
| @GetMapping("listShopFromContract") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData listShopFromContract(@ModelAttribute WxShop wxShop, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::listShopFromContract"); | |||
| if (null == wxShop){ | |||
| wxShop = new WxShop(); | |||
| } | |||
| wxShop.setTenantId(getTenantId()); | |||
| wxShop.setSortColumns(WxShop.Field.Id_DESC); | |||
| final PageInfo<Map<String, Object>> page = wxShopService.listShopFromContract(wxShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| } | |||
| @@ -4,6 +4,12 @@ import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import com.iformall.domain.po.WxTagsGroup; | |||
| import com.iformall.domain.po.WxTagsType; | |||
| import com.iformall.domain.vo.WxTagsGroupVo; | |||
| import com.iformall.domain.vo.WxTagsTypeVo; | |||
| import com.iformall.service.WxTagsGroupService; | |||
| import com.iformall.service.WxTagsTypeService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -15,7 +21,6 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxTags; | |||
| import com.iformall.domain.vo.WxTagsVo; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxTagsService; | |||
| @@ -30,79 +35,62 @@ public class WxTagsController extends BaseController { | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| @Autowired | |||
| private WxTagsGroupService wxTagsGroupService; | |||
| @Autowired | |||
| private WxTagsTypeService wxTagsTypeService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @GetMapping("getAllList") | |||
| @ApiOperation("标签弹窗接口") | |||
| public ResultData getAllList() { | |||
| List<WxTagsVo> type1List = new ArrayList<>(); | |||
| List<WxTags> tags = wxTagsService.findType1Value(); | |||
| for(WxTags t:tags) { | |||
| WxTagsVo vo =new WxTagsVo(); | |||
| vo.setValue(t.getType1()); | |||
| List<WxTagsVo> type2List =new ArrayList<>(); | |||
| List<WxTags> type2s = wxTagsService.findType2Value(t.getType1()); | |||
| for(WxTags wt:type2s) { | |||
| WxTagsVo v = new WxTagsVo(); | |||
| v.setValue(wt.getType2()); | |||
| List<WxTagsVo> list = new ArrayList<>(); | |||
| WxTags tag = new WxTags(); | |||
| tag.setType2(wt.getType2()); | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(tag, 1, 1000); | |||
| for(WxTags wxT : page.getList()) { | |||
| WxTagsVo wxVo = new WxTagsVo(); | |||
| wxVo.setId(wxT.getId()); | |||
| wxVo.setValue(wxT.getName()); | |||
| list.add(wxVo); | |||
| } | |||
| v.setSubTags(list); | |||
| type2List.add(v); | |||
| vo.setSubTags(type2List); | |||
| logger.debug("[" + getIpAddr() + "] WxTagsController::getAllList"); | |||
| List<WxTagsGroupVo> groupVos = new ArrayList<>(); | |||
| List<WxTagsGroup> groups = wxTagsGroupService.findList(null); | |||
| for(WxTagsGroup tg:groups) { | |||
| WxTagsGroupVo tgvo =new WxTagsGroupVo(); | |||
| tgvo.setId(tg.getId()); | |||
| tgvo.setName(tg.getName()); | |||
| WxTagsType type = new WxTagsType(); | |||
| type.setGroupId(tg.getId()); | |||
| List<WxTagsTypeVo> typeVos =new ArrayList<>(); | |||
| List<WxTagsType> types = wxTagsTypeService.findList(type); | |||
| for(WxTagsType tt:types) { | |||
| WxTagsTypeVo ttvo = new WxTagsTypeVo(); | |||
| ttvo.setId(tt.getId()); | |||
| ttvo.setName(tt.getName()); | |||
| ttvo.setFlag(tt.getFlag()); | |||
| ttvo.setGroupId(tg.getId()); | |||
| ttvo.setGroupName(tg.getName()); | |||
| WxTags t = new WxTags(); | |||
| t.setTypeId(tt.getId()); | |||
| ttvo.setTags(wxTagsService.findList(t)); | |||
| typeVos.add(ttvo); | |||
| } | |||
| type1List.add(vo); | |||
| tgvo.setTypes(typeVos); | |||
| groupVos.add(tgvo); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",type1List); | |||
| return new ResultData(groupVos); | |||
| } | |||
| @GetMapping("getPeopleTagList") | |||
| @ApiOperation("用户人群tag接口") | |||
| public ResultData getPeopleTagList() { | |||
| List<WxTagsVo> type2List =new ArrayList<>(); | |||
| List<WxTags> type2s = wxTagsService.findType2Value(null); | |||
| for(WxTags wt:type2s) { | |||
| WxTagsVo v = new WxTagsVo(); | |||
| v.setValue(wt.getType2()); | |||
| List<WxTagsVo> list = new ArrayList<>(); | |||
| WxTags tag = new WxTags(); | |||
| tag.setType2(wt.getType2()); | |||
| PageInfo<WxTags> page = wxTagsService.listAsPage(tag, 1, 1000); | |||
| for(WxTags wxT : page.getList()) { | |||
| WxTagsVo wxVo = new WxTagsVo(); | |||
| wxVo.setValue(wxT.getName()); | |||
| wxVo.setId(wxT.getId()); | |||
| list.add(wxVo); | |||
| } | |||
| v.setSubTags(list); | |||
| type2List.add(v); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",type2List); | |||
| } | |||
| @ApiOperation("查询微信用户人群") | |||
| @GetMapping("findCUserCountByTag") | |||
| public Result findCUserCountByTag(Long[] tagIds) { | |||
| long count = wxCUserTagsService.findCUserCountByTag(getTenantId(), Arrays.asList(tagIds)); | |||
| return new ResultData(Result.SUCCESS,"查询成功",count); | |||
| logger.debug("[" + getIpAddr() + "] WxTagsController::findCUserCountByTag"); | |||
| return new ResultData(wxCUserTagsService.findTagListFromCUser(getTenantId(), Arrays.asList(tagIds))); | |||
| } | |||
| @ApiOperation("查询会员用户人群") | |||
| @GetMapping("findCountByTag") | |||
| public Result findCountByTag(Long[] tagIds) { | |||
| long count = wxCUserTagsService.findCountByTag(getTenantId(), Arrays.asList(tagIds)); | |||
| return new ResultData(Result.SUCCESS,"查询成功",count); | |||
| logger.debug("[" + getIpAddr() + "] WxTagsController::findCountByTag"); | |||
| return new ResultData(wxCUserTagsService.findTagList(getTenantId(), Arrays.asList(tagIds))); | |||
| } | |||
| @@ -26,6 +26,7 @@ public class WxUserChannelController extends BaseController { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxUserChannel wxUserChannel, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserChannelController::list"); | |||
| if (null == wxUserChannel) wxUserChannel = new WxUserChannel(); | |||
| final PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(wxUserChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -34,6 +35,7 @@ public class WxUserChannelController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxUserChannel wxUserChannel) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserChannelController::add"); | |||
| //Assert.notNull(wxUserChannel.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxUserChannelService.saveOrUpdate(wxUserChannel); | |||
| @@ -43,6 +45,7 @@ public class WxUserChannelController extends BaseController { | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxUserChannel wxUserChannel) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserChannelController::update"); | |||
| wxUserChannelService.saveOrUpdate(wxUserChannel); | |||
| return new ResultData(); | |||
| } | |||
| @@ -51,6 +54,7 @@ public class WxUserChannelController extends BaseController { | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserChannelController::delete"); | |||
| wxUserChannelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -59,6 +63,7 @@ public class WxUserChannelController extends BaseController { | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserChannelController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxUserChannelService.getById(id)); | |||
| } | |||
| @@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| */ | |||
| @RestController | |||
| @RequestMapping("wxUserCoupon") | |||
| public class WxUserCouponController { | |||
| public class WxUserCouponController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @@ -29,6 +29,7 @@ public class WxUserCouponController { | |||
| @ApiOperation("查询用户卡券接口") | |||
| @PostMapping("findByStatus") | |||
| public ResultData findByStatus(@RequestBody WxUserCouponDto wxUserCoupon) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserCouponController::findByStatus"); | |||
| //根据用户id,用户卡券状态查找 | |||
| if(wxUserCoupon==null||wxUserCoupon.getcUserId()==null||wxUserCoupon.getCouponStatus()==null){ | |||
| return new ResultData(Result.ERROR,"查询失败"); | |||
| @@ -3,13 +3,12 @@ package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxUserChannel; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.UserStructureVo; | |||
| import com.iformall.enums.EnumAgeInfo; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserService; | |||
| import com.iformall.service.WxUserChannelService; | |||
| import com.iformall.enums.EnumCUserBaseInfoSex; | |||
| import com.iformall.enums.EnumTag; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -19,6 +18,7 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -38,27 +38,35 @@ public class WxUserStructureController extends BaseController { | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxLevelConfigService wxLevelConfigService; | |||
| @Autowired | |||
| private WxCUserCarService wxCUserCarService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| private WxUserChannelService wxUserChannelService; | |||
| /***************************会员结构*****************************/ | |||
| @ApiOperation("查询会员性别结构") | |||
| @GetMapping("/findUserSexStructure") | |||
| public ResultData findUserSexStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserSexStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| // if (endTime != null) { | |||
| // Calendar c = Calendar.getInstance(); | |||
| // c.setTime(endTime); | |||
| // c.add(Calendar.DAY_OF_YEAR, 1); | |||
| // endTime = c.getTime(); | |||
| // } | |||
| dto.setEndTime(endTime); | |||
| //保密 | |||
| dto.setSex(0); | |||
| dto.setSex(EnumCUserBaseInfoSex.UNKNOWN.getCode()); | |||
| long secrecy = wxCUserBasicInfoService.findCountBySex(dto); | |||
| dto.setSex(1); | |||
| dto.setSex(EnumCUserBaseInfoSex.MALE.getCode()); | |||
| long boy = wxCUserBasicInfoService.findCountBySex(dto); | |||
| dto.setSex(2); | |||
| dto.setSex(EnumCUserBaseInfoSex.FEMALE.getCode()); | |||
| long girl = wxCUserBasicInfoService.findCountBySex(dto); | |||
| Long all = secrecy + boy + girl; | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| @@ -71,15 +79,10 @@ public class WxUserStructureController extends BaseController { | |||
| @ApiOperation("查询会员年龄结构") | |||
| @GetMapping("/findUserAgeStructure") | |||
| public ResultData findUserAgeStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserAgeStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| // if (endTime != null) { | |||
| // Calendar c = Calendar.getInstance(); | |||
| // c.setTime(endTime); | |||
| // c.add(Calendar.DAY_OF_YEAR, 1); | |||
| // endTime = c.getTime(); | |||
| // } | |||
| dto.setEndTime(endTime); | |||
| long all = wxCUserBasicInfoService.findCount(dto); | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| @@ -96,9 +99,160 @@ public class WxUserStructureController extends BaseController { | |||
| return new ResultData(vos); | |||
| } | |||
| @ApiOperation("查询会员积分结构") | |||
| @GetMapping("/findUserLevelStructure") | |||
| public ResultData findUserLevelStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserAgeStructure"); | |||
| WxLevelConfig wxLevelConfig = new WxLevelConfig(); | |||
| wxLevelConfig.setTenantId(getTenantId()); | |||
| wxLevelConfig.setSortColumns(WxLevelConfig.Field.Points_ASC); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.findList(wxLevelConfig); | |||
| for( int i = 0; i < levelList.size(); i++) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| if (i == 0) { | |||
| dto.setLevelEndScore(levelList.get(i).getPoints()); | |||
| } else if (i == levelList.size()-1) { | |||
| dto.setLevelStartScore(levelList.get(i).getPoints()); | |||
| } else{ | |||
| dto.setLevelStartScore(levelList.get(i).getPoints()); | |||
| dto.setLevelEndScore(levelList.get(i+1).getPoints()); | |||
| } | |||
| long all = wxCUserBasicInfoService.findCountByScore(dto); | |||
| //null积分算最低级会员 | |||
| if (i == 0){ | |||
| dto.setLevelStartScore(null); | |||
| dto.setLevelEndScore(null); | |||
| all += wxCUserBasicInfoService.findCountByScore(dto); | |||
| } | |||
| levelList.get(i).setCount(all); | |||
| } | |||
| return new ResultData(levelList); | |||
| } | |||
| @ApiOperation("查询会员绑车牌结构") | |||
| @GetMapping("/findUserCarStructure") | |||
| public ResultData findCarLevelStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findCarLevelStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| long userCountWithCar = wxCUserCarService.countUser(dto); | |||
| Map userWithCar = new HashMap(); | |||
| userWithCar.put("title","已绑定车牌"); | |||
| userWithCar.put("count",userCountWithCar); | |||
| long userCountWithoutCar = total-userCountWithCar; | |||
| Map userWithoutCar = new HashMap(); | |||
| userWithoutCar.put("title","未绑定车牌"); | |||
| userWithoutCar.put("count",userCountWithoutCar); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| if(userCountWithoutCar + userCountWithCar>0) { | |||
| userWithCar.put("percentage",nf.format(userCountWithCar/new Double(userCountWithoutCar + userCountWithCar).doubleValue())); | |||
| userWithoutCar.put("percentage",nf.format(userCountWithoutCar/new Double(userCountWithoutCar + userCountWithCar).doubleValue())); | |||
| } else { | |||
| userWithCar.put("percentage","--"); | |||
| userWithoutCar.put("percentage","--"); | |||
| } | |||
| List<Map> list = new ArrayList<>(); | |||
| list.add(userWithCar); | |||
| list.add(userWithoutCar); | |||
| return new ResultData(list); | |||
| } | |||
| @ApiOperation("查询会员手机品牌结构") | |||
| @GetMapping("/findUserPhoneBandStructure") | |||
| public ResultData findUserPhoneBandStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserPhoneBandStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| List<WxTags> tagList = new ArrayList<>(); | |||
| EnumTag[] tags = {EnumTag.ID_49, | |||
| EnumTag.ID_50, | |||
| EnumTag.ID_51, | |||
| EnumTag.ID_52, | |||
| EnumTag.ID_53, | |||
| EnumTag.ID_54}; | |||
| for (int i = 0; i < tags.length; i++) { | |||
| WxTags tag = new WxTags(); | |||
| tag.setName(tags[i].getMessage()); | |||
| tag.setCount(wxCUserTagsService.countUser(getTenantId(), tags[i].getCode(), startTime, endTime)); | |||
| tagList.add(tag); | |||
| total -= tag.getCount(); | |||
| } | |||
| WxTags tag = new WxTags(); | |||
| tag.setName("暂未获取"); | |||
| tag.setCount(total); | |||
| tagList.add(tag); | |||
| return new ResultData(tagList); | |||
| } | |||
| @ApiOperation("查询会员活跃结构") | |||
| @GetMapping("/findUserActivityStructure") | |||
| public ResultData findUserActivityStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserActivityStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| List<WxTags> tagList = new ArrayList<>(); | |||
| EnumTag[] tags = { | |||
| EnumTag.ID_112, | |||
| EnumTag.ID_111, | |||
| EnumTag.ID_110 | |||
| }; | |||
| for (int i = 0; i < tags.length; i++) { | |||
| WxTags tag = new WxTags(); | |||
| tag.setName(tags[i].getMessage()); | |||
| tag.setCount(wxCUserTagsService.countUser(getTenantId(), tags[i].getCode(), startTime, endTime)); | |||
| tagList.add(tag); | |||
| total -= tag.getCount(); | |||
| } | |||
| WxTags tag = new WxTags(); | |||
| tag.setName("休眠"); | |||
| tag.setCount(total); | |||
| tagList.add(tag); | |||
| return new ResultData(tagList); | |||
| } | |||
| /********************************会员数据**************************************/ | |||
| @ApiOperation("查询会员数量") | |||
| @GetMapping("/findUserDataCount") | |||
| public ResultData findUserCount(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserCount"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| @@ -265,11 +419,13 @@ public class WxUserStructureController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData findUserByChannel(String channelName, Integer pageNum, Integer pageSize) { | |||
| public ResultData findUserByChannel(@ModelAttribute WxCUser wxCUser, | |||
| Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserByChannel"); | |||
| List<String> sceneList = null; | |||
| if (StringUtils.isNotBlank(channelName)) { | |||
| if (StringUtils.isNotBlank(wxCUser.getChannelName())) { | |||
| WxUserChannel c = new WxUserChannel(); | |||
| c.setChannelName(channelName); | |||
| c.setChannelName(wxCUser.getChannelName()); | |||
| PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(c, 1, 100); | |||
| if (page.getSize() > 0) { | |||
| sceneList = new ArrayList<>(); | |||
| @@ -278,7 +434,8 @@ public class WxUserStructureController extends BaseController { | |||
| } | |||
| } | |||
| } | |||
| PageInfo<WxCUser> page = wxCUserService.listByChannel(getTenantId(), sceneList, pageNum, pageSize); | |||
| wxCUser.setSceneList(sceneList); | |||
| PageInfo<WxCUser> page = wxCUserService.listByChannel(wxCUser, pageNum, pageSize); | |||
| for (WxCUser u : page.getList()) { | |||
| WxUserChannel c = new WxUserChannel(); | |||
| c.setSceneAddress(u.getSceneAddress()); | |||
| @@ -295,9 +452,53 @@ public class WxUserStructureController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("获取用户所有渠道") | |||
| @GetMapping("/findUserStructureByChannel") | |||
| public ResultData findUserStructureByChannel(@ModelAttribute WxCUser wxCUser) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserStructureByChannel"); | |||
| List<WxUserChannel> channelStructureList = new ArrayList<>(); | |||
| List<WxUserChannel> senceStructureList = new ArrayList<>(); | |||
| List<WxUserChannel> channels = wxUserChannelService.findDistinctChannel(); | |||
| for (WxUserChannel w : channels) { | |||
| WxUserChannel c = new WxUserChannel(); | |||
| c.setChannelName(w.getChannelName()); | |||
| PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(c, 1, 1000); | |||
| if (page.getSize() > 0) { | |||
| List<String> sceneList = new ArrayList<>(); | |||
| for (WxUserChannel uc : page.getList()) { | |||
| List<String> scene = new ArrayList<>(); | |||
| scene.add(uc.getSceneAddress()); | |||
| wxCUser.setSceneList(scene); | |||
| WxUserChannel senceStructure = new WxUserChannel(); | |||
| senceStructure.setDescription(uc.getDescription()); | |||
| senceStructure.setCount(wxCUserService.countByChannel(wxCUser)); | |||
| senceStructureList.add(senceStructure); | |||
| sceneList.add(uc.getSceneAddress()); | |||
| } | |||
| wxCUser.setSceneList(sceneList); | |||
| WxUserChannel channelStructure = new WxUserChannel(); | |||
| channelStructure.setChannelName(w.getChannelName()); | |||
| channelStructure.setCount(wxCUserService.countByChannel(wxCUser)); | |||
| channelStructureList.add(channelStructure); | |||
| } | |||
| } | |||
| HashMap result = new HashMap(); | |||
| Collections.sort(senceStructureList, (s1,s2) -> ((int)(s2.getCount()-s1.getCount()))); | |||
| result.put("channelList",channelStructureList); | |||
| result.put("senceList",senceStructureList.subList(0,10)); | |||
| return new ResultData(result); | |||
| } | |||
| @ApiOperation("获取用户所有渠道") | |||
| @GetMapping("/findAllUserChannel") | |||
| public ResultData findAllUserChannel() { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findAllUserChannel"); | |||
| List<WxUserChannel> channels = wxUserChannelService.findDistinctChannel(); | |||
| List<String> vos = new ArrayList<>(); | |||
| for (WxUserChannel w : channels) { | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/11/16. | |||
| */ | |||
| public enum EnumLoginType { | |||
| // 0-password, 1-nopassword | |||
| PASSWORD(0, "PASSWORD"), | |||
| NOPASSWD(1, "NOPASSWORD") | |||
| ; | |||
| public static EnumLoginType getEnum(Integer code) { | |||
| for (EnumLoginType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumLoginType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -1,38 +0,0 @@ | |||
| package com.iformall.schedule; | |||
| import com.iformall.mapper.*; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.scheduling.annotation.Scheduled; | |||
| import org.springframework.stereotype.Component; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| @Component | |||
| public class CouponExpiringSchedule { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponChannelMapper wxCouponChannelMapper; | |||
| @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 | |||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void couponExpiringSchedule() { | |||
| } | |||
| @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 | |||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | |||
| public void couponChannelExpiringSchedule() { | |||
| wxCouponChannelMapper.offExpiriedCouponChannelByEndTime(); | |||
| wxCouponChannelMapper.offExpiriedCouponChannelByValidDate(); | |||
| wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.iformall.shiro; | |||
| import com.iformall.enums.EnumLoginType; | |||
| import org.apache.shiro.authc.AuthenticationInfo; | |||
| import org.apache.shiro.authc.AuthenticationToken; | |||
| import org.apache.shiro.authc.credential.HashedCredentialsMatcher; | |||
| import org.springframework.context.annotation.Configuration; | |||
| @Configuration | |||
| public class MyRetryLimitCredentialsMatcher extends HashedCredentialsMatcher { | |||
| @Override | |||
| public boolean doCredentialsMatch(AuthenticationToken authcToken, AuthenticationInfo info) { | |||
| if(authcToken instanceof UseriFormallToken) { | |||
| UseriFormallToken tk = (UseriFormallToken) authcToken; | |||
| if(tk.getType().equals(EnumLoginType.NOPASSWD)){ | |||
| return true; | |||
| } | |||
| boolean matches = super.doCredentialsMatch(authcToken, info); | |||
| return matches; | |||
| } | |||
| boolean matches =super.doCredentialsMatch(authcToken, info); | |||
| return matches; | |||
| } | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.shiro; | |||
| import javax.annotation.Resource; | |||
| import com.iformall.enums.EnumMallUserStatus; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.AuthenticationException; | |||
| @@ -51,11 +52,14 @@ public class MyShiroRealm extends AuthorizingRealm { | |||
| //获取用户的输入的账号. | |||
| String username = (String)token.getPrincipal(); | |||
| MallUserInfo user = userService.getByUsername(username); | |||
| if(user==null) throw new UnknownAccountException("用户名不存在"); | |||
| // if (0==user.getEnable()) { | |||
| // throw new LockedAccountException(); // 帐号锁定 | |||
| // } | |||
| if(user.getStatus()==null || 1!=user.getStatus()) {//用户被禁用 | |||
| if(user == null) { | |||
| throw new UnknownAccountException("用户名不存在"); | |||
| } | |||
| // if (0==user.getEnable()) { | |||
| // throw new LockedAccountException(); // 帐号锁定 | |||
| // } | |||
| if(user.getStatus()==null || | |||
| !EnumMallUserStatus.VALID.getCode().equals(user.getStatus())) {//用户被禁用 | |||
| throw new UnknownAccountException("用户被禁用"); | |||
| } | |||
| SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo( | |||
| @@ -68,6 +72,7 @@ public class MyShiroRealm extends AuthorizingRealm { | |||
| Session session = SecurityUtils.getSubject().getSession(); | |||
| session.setAttribute(UserSession.userInfo, user); | |||
| session.setAttribute(UserSession.userId, user.getId()); | |||
| session.setAttribute(UserSession.tenantId, user.getTenantId()); | |||
| return authenticationInfo; | |||
| } | |||
| @@ -6,4 +6,6 @@ public class UserSession { | |||
| public static String userId ="userSessionId"; | |||
| public static String tenantId ="TENANT_ID"; | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.shiro; | |||
| import com.iformall.enums.EnumLoginType; | |||
| import org.apache.shiro.authc.UsernamePasswordToken; | |||
| public class UseriFormallToken extends UsernamePasswordToken { | |||
| private static final long serialVersionUID = -2564928913725078138L; | |||
| private EnumLoginType type; | |||
| public UseriFormallToken() { | |||
| super(); | |||
| } | |||
| public UseriFormallToken(String username, String password, EnumLoginType type, boolean rememberMe, String host) { | |||
| super(username, password, rememberMe, host); | |||
| this.type = type; | |||
| } | |||
| /** 免密登录 */ | |||
| public UseriFormallToken(String username) { | |||
| super(username, "", false, null); | |||
| this.type = EnumLoginType.NOPASSWD; | |||
| } | |||
| /** 账号密码登录 */ | |||
| public UseriFormallToken(String username, String pwd) { | |||
| super(username, pwd, false, null); | |||
| this.type = EnumLoginType.PASSWORD; | |||
| } | |||
| public EnumLoginType getType() { | |||
| return type; | |||
| } | |||
| public void setType(EnumLoginType type) { | |||
| this.type = type; | |||
| } | |||
| } | |||
| @@ -0,0 +1,74 @@ | |||
| package com.iformall.tenant; | |||
| import com.iformall.plugin.TenantInfo; | |||
| import com.iformall.shiro.UserSession; | |||
| import org.apache.ibatis.mapping.MappedStatement; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.session.InvalidSessionException; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| public class TenantInfoImpl implements TenantInfo { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Override | |||
| public String getTenantId() { | |||
| String tenantId = ""; | |||
| try { | |||
| tenantId = (String) SecurityUtils.getSubject().getSession().getAttribute(UserSession.tenantId); | |||
| } catch (InvalidSessionException e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| return tenantId; | |||
| } | |||
| @Override | |||
| public boolean doTableFilter(String tableName) { | |||
| if ("mall_permission".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("mall_user_role".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_channel".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_business".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_coupon_type".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_game_template".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_group".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_mall_apply".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_tags".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_tags_group".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_tags_type".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_user_channel".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @Override | |||
| public boolean doMappedStatementFIlter(MappedStatement ms) { | |||
| if ("com.iformall.mapper.MallUserInfoMapper.selectByUserName".equals(ms.getId())) | |||
| return true; | |||
| if ("com.iformall.mapper.WxCouponActionLogMapper.getCountByUserAndCoupon".equals(ms.getId())) | |||
| return true; | |||
| return false; | |||
| } | |||
| } | |||
| @@ -1,6 +0,0 @@ | |||
| package com.iformall.utils; | |||
| public class Constant { | |||
| public static final String fileDirectory="./uploads"; | |||
| } | |||
| @@ -1,11 +1,11 @@ | |||
| spring: | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&useSSL=false | |||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false | |||
| username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) | |||
| password: ENC(OZXsE6/Tj+V1Yu2wdjnIGbNOaBVQzi9W) | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| driver_class: com.mysql.cj.jdbc.Driver | |||
| driver-class-name: com.mysql.cj.jdbc.Driver | |||
| filters: stat | |||
| maxActive: 20 | |||
| initialSize: 1 | |||
| @@ -26,20 +26,21 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| port: 6789 | |||
| password: ENC(YOLO4buIPjiYfosG+Akk3XZ9HYrbCFco) | |||
| timeout: 0 | |||
| port: 6379 | |||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| pool: | |||
| max-active: 8 | |||
| max-idle: 8 | |||
| max-wait: -1 | |||
| min-idle: 0 | |||
| fileUpload: | |||
| path: /home/test/images | |||
| server: http://202.165.179.86:8081/images | |||
| database: 1 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 500 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| com.iformall: debug | |||
| path: ./logs/admin | |||
| @@ -1,11 +1,11 @@ | |||
| spring: | |||
| # JDBC | |||
| datasource: | |||
| url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?characterEncoding=UTF-8 | |||
| url: jdbc:mysql://formalldb.cfqyqflkdlit.rds.cn-northwest-1.amazonaws.com.cn:3306/mallink?useUnicode=true&characterEncoding=UTF-8 | |||
| username: ENC(BDv01/sQdBGEhFEXuw+8tw==) | |||
| password: ENC(0wvpX49+RMUpGP2tb9PY4ta/yCwAmLLhbKG9ndvifPI=) | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| driver_class: com.mysql.cj.jdbc.Driver | |||
| driver-class-name: com.mysql.cj.jdbc.Driver | |||
| filters: stat | |||
| maxActive: 20 | |||
| initialSize: 1 | |||
| @@ -23,22 +23,20 @@ spring: | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| port: 6789 | |||
| port: 6379 | |||
| password: ENC(YOLO4buIPjiYfosG+Akk3XZ9HYrbCFco) | |||
| timeout: 0 | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| pool: | |||
| max-active: 8 | |||
| max-idle: 8 | |||
| max-wait: -1 | |||
| min-idle: 0 | |||
| database: 1 | |||
| jedis: | |||
| pool: | |||
| max-active: 8 | |||
| max-idle: 8 | |||
| max-wait: -1 | |||
| min-idle: 0 | |||
| fileUpload: | |||
| path: /home/test/images | |||
| server: http://202.165.179.86:8081/images | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/admin | |||
| @@ -1,6 +1,7 @@ | |||
| server: | |||
| port: 9000 | |||
| context-path: / | |||
| servlet: | |||
| context-path: / | |||
| spring: | |||
| application: | |||
| @@ -10,10 +11,16 @@ spring: | |||
| jackson: | |||
| date-format: yyyy-MM-dd HH:mm:ss | |||
| time-zone: GMT+8 | |||
| http: | |||
| default-property-inclusion: non_null | |||
| servlet: | |||
| multipart: | |||
| max-file-size: 2MB | |||
| max-request-size: 2MB | |||
| cache: | |||
| type: REDIS | |||
| cache-names: redis_cache #缓存的名字(可以不指定) | |||
| redis: | |||
| time-to-live: 60000ms #很重要,缓存的有效时间,以便缓存的过期(单位为毫秒) | |||
| # @{link} https://github.com/abel533 | |||
| @@ -12,7 +12,8 @@ | |||
| <appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
| <file>${logPath}/trace.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <FileNamePattern>${logPath}/daily/trace.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -22,7 +23,8 @@ | |||
| <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
| <file>${logPath}/info.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <FileNamePattern>${logPath}/daily/info.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -37,7 +39,8 @@ | |||
| <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
| <file>${logPath}/debug.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <FileNamePattern>${logPath}/daily/debug.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -53,7 +56,8 @@ | |||
| <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
| <file>${logPath}/warn.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <FileNamePattern>${logPath}/daily/warn.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -70,7 +74,8 @@ | |||
| <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
| <file>${logPath}/error.log</file> | |||
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
| <FileNamePattern>${logPath}/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <FileNamePattern>${logPath}/daily/error.%d{yyyy-MM-dd}.log</FileNamePattern> | |||
| <maxHistory>180</maxHistory> <!-- 保留180天 --> | |||
| </rollingPolicy> | |||
| <layout> | |||
| <pattern>[%date{yyyy-MM-dd HH:mm:ss}] [%-5level] [%logger:%line]--%mdc{client} %msg%n</pattern> | |||
| @@ -17,7 +17,11 @@ | |||
| <artifactId>mallinkService</artifactId> | |||
| <version>1.0</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.iformall</groupId> | |||
| <artifactId>mybatis-multi-tenancy</artifactId> | |||
| <version>1.0</version> | |||
| </dependency> | |||
| </dependencies> | |||
| <build> | |||
| <plugins> | |||