├── .gitignore ├── README.md ├── init.sql ├── libs ├── pdd-sdk.jar └── tb-sdk.jar ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── superman │ │ └── superman │ │ ├── SupermanApplication.java │ │ ├── annotation │ │ ├── FastCache.java │ │ └── LoginRequired.java │ │ ├── aspect │ │ └── CacheAspect.java │ │ ├── config │ │ ├── CacheConfiguration.java │ │ ├── GlobalExceptionHandler.java │ │ ├── MetaHandler.java │ │ ├── MyBatisPlusConfig.java │ │ ├── RestTemplateConfig.java │ │ ├── Swagger2Configuration.java │ │ └── WebConfig.java │ │ ├── controller │ │ ├── CollectController.java │ │ ├── HtmlController.java │ │ ├── MemberController.java │ │ ├── MyOderController.java │ │ ├── OtherController.java │ │ ├── PayController.java │ │ ├── ScoreController.java │ │ ├── ShopGoodController.java │ │ ├── SysAdviceController.java │ │ ├── TaobaoController.java │ │ ├── TeamController.java │ │ └── UserController.java │ │ ├── dao │ │ ├── AgentDao.java │ │ ├── AllDevOderMapper.java │ │ ├── BaseDao.java │ │ ├── CollectDao.java │ │ ├── HotUserMapper.java │ │ ├── InvCodeDao.java │ │ ├── LogDao.java │ │ ├── OderMapper.java │ │ ├── OrderSuperDao.java │ │ ├── PayDao.java │ │ ├── ScoreDao.java │ │ ├── SettingDao.java │ │ ├── SysAdviceDao.java │ │ ├── SysDaygoodsDao.java │ │ ├── SysFriendDtoMapper.java │ │ ├── SysJhPddAllDao.java │ │ ├── SysJhTaobaoHotDao.java │ │ ├── UserMapper.java │ │ └── UserinfoMapper.java │ │ ├── dto │ │ ├── CollectBeanDto.java │ │ ├── GoodsDetailReq.java │ │ ├── GoodsDetailResponse.java │ │ ├── GoodsSearchReq.java │ │ ├── GoodsSearchResponse.java │ │ ├── MemberDetail.java │ │ ├── SysDayGoodDto.java │ │ ├── SysFriendDto.java │ │ ├── SysJhProblem.java │ │ ├── SysJhVideoTutorial.java │ │ └── UserCreateReq.java │ │ ├── event │ │ └── CreateUserEvent.java │ │ ├── manager │ │ ├── ConfigQueryManager.java │ │ ├── OderManager.java │ │ └── UserManager.java │ │ ├── model │ │ ├── Agent.java │ │ ├── ApplyCash.java │ │ ├── BannerGoods.java │ │ ├── BaseBean.java │ │ ├── CollectBean.java │ │ ├── Config.java │ │ ├── JdOder.java │ │ ├── Oder.java │ │ ├── ScoreBean.java │ │ ├── SysAdvice.java │ │ ├── SysDaygoods.java │ │ ├── SysJhAdviceDev.java │ │ ├── SysJhAdviceOder.java │ │ ├── SysJhImage.java │ │ ├── SysJhJdHot.java │ │ ├── SysJhPddAll.java │ │ ├── SysJhTaobaoAll.java │ │ ├── SysJhTaobaoHot.java │ │ ├── Tboder.java │ │ ├── TokenModel.java │ │ ├── User.java │ │ ├── UserLog.java │ │ ├── Userinfo.java │ │ └── enums │ │ │ ├── LogOperationEnum.java │ │ │ ├── Mall.java │ │ │ ├── Platform.java │ │ │ ├── UserLevel.java │ │ │ └── uso.java │ │ ├── platform │ │ ├── AbstractCommonService.java │ │ ├── CommonService.java │ │ ├── JdBasePlatformService.java │ │ ├── PddBasePlatformService.java │ │ ├── TaobaoBasePlatformService.java │ │ └── dto │ │ │ ├── BaseGoodSearchResponse.java │ │ │ ├── PddGoodSearchRequest.java │ │ │ └── baseGoodSearchRequest.java │ │ ├── redis │ │ ├── RedisTemplateService.java │ │ ├── RedisTemplateServiceImpl.java │ │ └── RedisUtil.java │ │ ├── req │ │ ├── AuthenticationInterceptor.java │ │ ├── BindWxToUser.java │ │ ├── Collect.java │ │ ├── OderPdd.java │ │ ├── OptReq.java │ │ └── UpdateWxOpenId.java │ │ ├── service │ │ ├── AdviceService.java │ │ ├── CollectService.java │ │ ├── FriendDtoService.java │ │ ├── GoodsService.java │ │ ├── JdApiService.java │ │ ├── LogService.java │ │ ├── MemberService.java │ │ ├── MoneyService.java │ │ ├── OderService.java │ │ ├── OtherService.java │ │ ├── PddApiService.java │ │ ├── ScoreService.java │ │ ├── SysDaygoodsService.java │ │ ├── TaoBaoApiService.java │ │ ├── TokenService.java │ │ ├── UserService.java │ │ └── impl │ │ │ ├── AdviceServiceImpl.java │ │ │ ├── CollectServiceImpl.java │ │ │ ├── FriendDtoServiceImpl.java │ │ │ ├── GoodsServiceImpl.java │ │ │ ├── JdApiServiceImpl.java │ │ │ ├── LogServiceImpl.java │ │ │ ├── MemberServiceImpl.java │ │ │ ├── MoneyServiceImpl.java │ │ │ ├── OderServiceImpl.java │ │ │ ├── OtherServiceImpl.java │ │ │ ├── PddApiServiceImpl.java │ │ │ ├── ScoreServiceImpl.java │ │ │ ├── SysDaygoodsServiceImpl.java │ │ │ ├── TaoBaoApiServiceImpl.java │ │ │ ├── TokenServiceImpl.java │ │ │ └── UserServiceImpl.java │ │ └── utils │ │ ├── Constants.java │ │ ├── ConvertUtils.java │ │ ├── ErrorBean.java │ │ ├── EveryUtils.java │ │ ├── GoodUtils.java │ │ ├── MyException.java │ │ ├── PageParam.java │ │ ├── PageUtils.java │ │ ├── Query.java │ │ ├── RedisConfig.java │ │ ├── RequestUtil.java │ │ ├── Response.java │ │ ├── ResponseCode.java │ │ ├── ResponseUtil.java │ │ ├── Result.java │ │ ├── ShareCodeUtils.java │ │ ├── SmsSendDemo.java │ │ ├── SmsUtil.java │ │ ├── StringUtil.java │ │ ├── TokenState.java │ │ ├── Util.java │ │ ├── XmlUtil.java │ │ ├── net │ │ ├── HttpRequest.java │ │ ├── HttpUtil.java │ │ └── NetUtils.java │ │ ├── sign │ │ ├── EverySign.java │ │ ├── MD5.java │ │ ├── MD5Util.java │ │ └── RandomUtils.java │ │ └── sms │ │ └── SmsSend.java └── resources │ ├── application-prod.yml │ ├── application.yml │ ├── generatorConfig_mysql.xml │ ├── mapper │ ├── AllDevOderMapper.xml │ ├── CollectMapper.xml │ ├── OderMapper.xml │ ├── OrderSuperDao.xml │ ├── ScoreMapper.xml │ ├── SysAdviceDao.xml │ ├── SysDaygoodsDao.xml │ ├── SysJhPddAllDao.xml │ ├── SysJhTaobaoHotDao.xml │ └── UserinfoMapper.xml │ ├── mysql-connector-java-5.0.8.jar │ └── static │ └── user │ ├── clipboard.min.js │ ├── index.html │ ├── jquery-3.2.1.min.js │ ├── layer.mobile-v2.0 │ ├── demo.url │ ├── doc │ │ ├── 官网.url │ │ └── 有问必答.url │ ├── layer_mobile │ │ ├── layer.js │ │ └── need │ │ │ └── layer.css │ ├── layim.url │ └── 更新日志.txt │ ├── shop.html │ └── zhuche_bg@2x.png └── test └── java └── com └── superman └── superman ├── CreatePidTest.java ├── JdApiTest.java ├── MemberServiceTest.java ├── NoteTest.java ├── ScoreTest.java ├── Supermaests.java ├── TaobaoApiTest.java └── maven /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 返利分销商城 2 | 3 | ##技术栈 4 | 1.Mybatis-plus 3.0 5 | 2.java8 语法 6 | 7 | 8 | ### 后续会封装第三方业务SDK 并区分开返利计算业务 9 | 淘宝 京东 拼多多 第三方安装SDK在 QQ群下载 10 | 11 | SDK jar包如何安装在本地maven仓库 见此 12 | https://blog.csdn.net/sinat_35181178/article/details/82027372 13 | 有问题加我的QQ群 577687485 14 | 15 | 16 | ![Pandao editor.md](http://47.100.187.103/qq.png "qq") 17 | -------------------------------------------------------------------------------- /libs/pdd-sdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GGsnake/ShopMall/607c4d85778df12b76363be8aaec246a4dec0cb7/libs/pdd-sdk.jar -------------------------------------------------------------------------------- /libs/tb-sdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GGsnake/ShopMall/607c4d85778df12b76363be8aaec246a4dec0cb7/libs/tb-sdk.jar -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/SupermanApplication.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cache.annotation.EnableCaching; 7 | import org.springframework.scheduling.annotation.EnableAsync; 8 | import org.springframework.scheduling.annotation.EnableScheduling; 9 | import org.springframework.web.client.RestTemplate; 10 | 11 | 12 | @SpringBootApplication 13 | @EnableCaching 14 | @EnableAsync 15 | @EnableScheduling 16 | @MapperScan("com.superman.superman.dao") 17 | public class SupermanApplication { 18 | public static void main(String[] args) { 19 | SpringApplication.run(SupermanApplication.class, args); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/annotation/FastCache.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target({ElementType.METHOD}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface FastCache { 11 | 12 | int timeOut() default 5; // 超时时间 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/annotation/LoginRequired.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Created by liujupeng on 2018/11/21. 10 | */ 11 | @Target({ElementType.METHOD}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface LoginRequired { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/aspect/CacheAspect.java: -------------------------------------------------------------------------------- 1 | //package com.superman.superman.aspect; 2 | // 3 | //import com.alibaba.fastjson.JSON; 4 | //import com.alibaba.fastjson.JSONObject; 5 | //import com.superman.superman.annotation.FastCache; 6 | //import com.superman.superman.redis.RedisUtil; 7 | //import lombok.extern.java.Log; 8 | //import org.apache.commons.lang3.StringUtils; 9 | //import org.aspectj.lang.JoinPoint; 10 | //import org.aspectj.lang.ProceedingJoinPoint; 11 | //import org.aspectj.lang.annotation.Around; 12 | //import org.aspectj.lang.annotation.Aspect; 13 | //import org.aspectj.lang.annotation.Pointcut; 14 | //import org.aspectj.lang.reflect.MethodSignature; 15 | //import org.springframework.beans.factory.annotation.Autowired; 16 | //import org.springframework.stereotype.Component; 17 | // 18 | //import java.lang.reflect.Method; 19 | //import java.util.concurrent.TimeUnit; 20 | // 21 | //@Component 22 | //@Aspect 23 | //@Log 24 | //public class CacheAspect { 25 | // @Autowired 26 | // private RedisUtil redisUtil; 27 | // 28 | // @Pointcut("@annotation(com.superman.superman.annotation.FastCache)") 29 | // public void logPointCut() { 30 | // } 31 | // 32 | // @Around("logPointCut()") 33 | // public Object aroundManagerLogPoint(ProceedingJoinPoint jp) throws Throwable { 34 | // Object result = null; 35 | // Method method = getMethod(jp); 36 | // // 获取注解 37 | // FastCache fastCache = method.getAnnotation(FastCache.class); 38 | // //获得方法名 39 | // String name = method.getName(); 40 | // // 判断是否使用缓存 41 | // int timeOut = fastCache.timeOut(); 42 | // String key = name + ":" + generateKey(jp); 43 | // Class returnType = ((MethodSignature) jp.getSignature()).getReturnType(); 44 | // 45 | // result = redisUtil.get(key); 46 | // if (result == null) { 47 | // result = jp.proceed(jp.getArgs()); 48 | // redisUtil.setForTimeCustom(key, JSONObject.toJSONString(result), timeOut, TimeUnit.SECONDS); 49 | // return result; 50 | // } 51 | // JSONObject jsonObject1 = JSONObject.parseObject(result.toString()); 52 | // Object jsonObject = JSON.toJavaObject(jsonObject1,returnType); 53 | // return jsonObject; 54 | // } 55 | // 56 | // // 生成缓存 key策略 57 | // private String generateKey(ProceedingJoinPoint point) { 58 | // StringBuffer key = new StringBuffer(); 59 | // key.append(StringUtils.join(point.getArgs(), "::")); 60 | // return key.toString(); 61 | // } 62 | // 63 | // /** 64 | // * @param joinPoint 65 | // * @return 66 | // * @Title: getMethod 67 | // * @Description: 获取被拦截方法对象 68 | // */ 69 | // protected Method getMethod(JoinPoint joinPoint) throws Exception { 70 | // 71 | // MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); 72 | // 73 | // Method method = methodSignature.getMethod(); 74 | // 75 | // return method; 76 | // } 77 | // 78 | // public T hget(JSON field, Class clazz) { 79 | // T result = (T) JSONObject.toJavaObject(field,clazz); 80 | // return result; 81 | // } 82 | //} 83 | // 84 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/config/CacheConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cache.annotation.EnableCaching; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.data.redis.cache.RedisCacheManager; 8 | import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.serializer.StringRedisSerializer; 11 | 12 | /** 13 | * Created by snake on 2018/11/16. 14 | */ 15 | @Configuration 16 | @EnableCaching 17 | public class CacheConfiguration { 18 | @Autowired 19 | private JedisConnectionFactory jedisConnectionFactory; 20 | @Bean 21 | public RedisCacheManager cacheManager() { 22 | RedisCacheManager redisCacheManager = new RedisCacheManager(redisTemplate()); 23 | return redisCacheManager; 24 | } 25 | @Bean 26 | public RedisTemplate redisTemplate() { 27 | RedisTemplate redisTemplate = new RedisTemplate(); 28 | redisTemplate.setConnectionFactory(jedisConnectionFactory); 29 | // 开启事务支持 30 | redisTemplate.setEnableTransactionSupport(true); 31 | // 使用String格式序列化缓存键 32 | StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); 33 | redisTemplate.setKeySerializer(stringRedisSerializer); 34 | redisTemplate.setHashKeySerializer(stringRedisSerializer); 35 | return redisTemplate; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/config/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.config; 2 | 3 | import com.superman.superman.utils.ErrorBean; 4 | import org.springframework.web.bind.annotation.ControllerAdvice; 5 | import org.springframework.web.bind.annotation.ExceptionHandler; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * Created by snake on 2018/11/19. 11 | */ 12 | @ControllerAdvice 13 | public class GlobalExceptionHandler { 14 | 15 | 16 | @ExceptionHandler(value = RuntimeException.class) 17 | @ResponseBody 18 | public ErrorBean jsonErrorHandler(HttpServletRequest req, RuntimeException e) { 19 | ErrorBean r = new ErrorBean<>(); 20 | r.setMessage(e.getMessage()); 21 | r.setCode(ErrorBean.ERROR); 22 | r.setData("Some Data"); 23 | r.setUrl(req.getRequestURL().toString()); 24 | return r; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/config/MetaHandler.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.config; 2 | 3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; 4 | import org.apache.ibatis.reflection.MetaObject; 5 | import org.mybatis.logging.Logger; 6 | import org.mybatis.logging.LoggerFactory; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.time.Instant; 10 | @Component 11 | public class MetaHandler implements MetaObjectHandler { 12 | private static final Logger logger = LoggerFactory.getLogger(MetaHandler.class); 13 | 14 | /** 15 | * 新增数据执行 16 | * @param metaObject 17 | */ 18 | @Override 19 | public void insertFill(MetaObject metaObject) { 20 | this.setFieldValByName("createTime", Instant.now(), metaObject); 21 | this.setFieldValByName("updateTime", Instant.now(), metaObject); 22 | this.setFieldValByName("status", Boolean.FALSE, metaObject); 23 | } 24 | 25 | /** 26 | * 更新数据执行 27 | * @param metaObject 28 | */ 29 | @Override 30 | public void updateFill(MetaObject metaObject) { 31 | this.setFieldValByName("updateTime", Instant.now(), metaObject); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/config/MyBatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.config; 2 | 3 | import com.baomidou.mybatisplus.core.config.GlobalConfig; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | public class MyBatisPlusConfig { 9 | /** 10 | * 自动填充功能 11 | * @return 12 | */ 13 | @Bean 14 | public GlobalConfig globalConfig() { 15 | GlobalConfig globalConfig = new GlobalConfig(); 16 | globalConfig.setMetaObjectHandler(new MetaHandler()); 17 | return globalConfig; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/config/RestTemplateConfig.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.http.client.ClientHttpRequestFactory; 6 | import org.springframework.http.client.SimpleClientHttpRequestFactory; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | /** 10 | * Created by snake on 2018/12/12. 11 | */ 12 | @Configuration 13 | public class RestTemplateConfig { 14 | @Bean 15 | public RestTemplate restTemplate(ClientHttpRequestFactory factory){ 16 | return new RestTemplate(factory); 17 | } 18 | 19 | @Bean 20 | public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ 21 | SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); 22 | factory.setReadTimeout(5000);//单位为ms 23 | factory.setConnectTimeout(5000);//单位为ms 24 | return factory; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/config/Swagger2Configuration.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | @Configuration 14 | @EnableSwagger2 15 | public class Swagger2Configuration { 16 | //api接口包扫描路径 17 | public static final String SWAGGER_SCAN_BASE_PACKAGE = "com.muyao.galaxy"; 18 | public static final String VERSION = "1.0.0"; 19 | @Bean 20 | public Docket createRestApi() { 21 | return new Docket(DocumentationType.SWAGGER_2) 22 | .apiInfo(apiInfo()) 23 | .select() 24 | .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)) 25 | .paths(PathSelectors.any()) // 可以根据url路径设置哪些请求加入文档,忽略哪些请求 26 | .build(); 27 | } 28 | private ApiInfo apiInfo() { 29 | return new ApiInfoBuilder() 30 | .title("单词计数服务") //设置文档的标题 31 | .description("单词计数服务 API 接口文档") // 设置文档的描述 32 | .version(VERSION) // 设置文档的版本信息-> 1.0.0 Version information 33 | .termsOfServiceUrl("http://www.baidu.com") // 设置文档的License信息->1.3 License information 34 | .build(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.config; 2 | 3 | import com.superman.superman.req.AuthenticationInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 9 | 10 | /** 11 | * Created by snake on 2018/11/21. 12 | */ 13 | @Configuration 14 | public class WebConfig extends WebMvcConfigurerAdapter { 15 | 16 | 17 | @Override 18 | public void addInterceptors(InterceptorRegistry registry) { 19 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/team/**"); 20 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/member/**"); 21 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/collect/**"); 22 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/other/**"); 23 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/Shop/**"); 24 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/oder/**"); 25 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/taobao/**"); 26 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/score/**"); 27 | registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/wx/**"); 28 | } 29 | @Bean 30 | public AuthenticationInterceptor authenticationInterceptor(){ 31 | return new AuthenticationInterceptor(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/controller/HtmlController.java: -------------------------------------------------------------------------------- 1 | //package com.superman.superman.controller; 2 | // 3 | //import com.superman.superman.dao.UserinfoMapper; 4 | //import com.superman.superman.model.Userinfo; 5 | //import lombok.extern.java.Log; 6 | //import org.springframework.beans.factory.annotation.Autowired; 7 | //import org.springframework.stereotype.Controller; 8 | //import org.springframework.web.bind.annotation.RequestMapping; 9 | // 10 | ///** 11 | // * Created by snake on 2018/12/20. 12 | // */ 13 | //@Controller 14 | //@Log 15 | //public class HtmlController { 16 | // private static final String URL = "https://api.open.21ds.cn/jd_api_v1/"; 17 | // 18 | // /** 19 | // * 二维码处理识别 20 | // * 21 | // * @return 22 | // */ 23 | // @RequestMapping("/queryCodeUrl") 24 | // public String queryUserUrl() { 25 | // return "index"; 26 | // } 27 | // 28 | // @Autowired 29 | // private UserinfoMapper userinfoMapper; 30 | // 31 | // /** 32 | // * 淘宝账户授权回调 33 | // */ 34 | // @RequestMapping("tbAuth") 35 | // public String money(Integer relation_id, Integer custompar, String account_name, String desc) { 36 | // Userinfo relation = userinfoMapper.selectByPrimaryKey(custompar.longValue()); 37 | // if (relation == null || relation.getRid() != null) { 38 | // return null; 39 | // } 40 | // Integer hasRegister = userinfoMapper.relationIdExits(relation_id.toString()); 41 | // if (hasRegister != null) { 42 | // return null; 43 | // 44 | // } 45 | // Userinfo userinfo = new Userinfo(); 46 | // userinfo.setId(custompar.longValue()); 47 | // userinfo.setRid(relation_id.toString()); 48 | // userinfoMapper.updateUserForRid(userinfo); 49 | // return null; 50 | // 51 | // } 52 | // 53 | //} 54 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/controller/MyOderController.java: -------------------------------------------------------------------------------- 1 | //package com.superman.superman.controller; 2 | // 3 | //import com.alibaba.fastjson.JSONObject; 4 | //import com.superman.superman.annotation.LoginRequired; 5 | //import com.superman.superman.dao.UserinfoMapper; 6 | //import com.superman.superman.manager.OderManager; 7 | //import com.superman.superman.model.Oder; 8 | //import com.superman.superman.redis.RedisUtil; 9 | //import com.superman.superman.service.MemberService; 10 | //import com.superman.superman.service.OderService; 11 | //import com.superman.superman.utils.*; 12 | //import org.springframework.beans.factory.annotation.Autowired; 13 | //import org.springframework.beans.factory.annotation.Value; 14 | //import org.springframework.web.bind.annotation.*; 15 | // 16 | //import javax.servlet.http.HttpServletRequest; 17 | //import java.util.List; 18 | //import java.util.concurrent.TimeUnit; 19 | // 20 | ///** 21 | // * Created by snake on 2018/11/24. 22 | // */ 23 | //@RestController 24 | //@RequestMapping("/oder") 25 | //public class MyOderController { 26 | // @Autowired 27 | // private RedisUtil redisUtil; 28 | // @Autowired 29 | // private OderManager oderManager; 30 | // @Autowired 31 | // private MemberService memberService; 32 | // 33 | // 34 | // @LoginRequired 35 | // @PostMapping("/myOder") 36 | // public Response queryAllOder(HttpServletRequest request, PageParam pageParam, Integer devId, Integer status) { 37 | // String uid = (String) request.getAttribute(Constants.CURRENT_USER_ID); 38 | // if (uid == null || status == null || status >= 3 || status < 0) { 39 | // return ResponseUtil.fail(ResponseCode.COMMON_PARAMS_MISSING); 40 | // } 41 | // PageParam param = new PageParam(pageParam.getPageNo(), pageParam.getPageSize()); 42 | // List statusList = ConvertUtils.getStatus(devId, status); 43 | // JSONObject allOder = new JSONObject(); 44 | // if (devId == 0) { 45 | // allOder = oderManager.getTaobaoOder(Long.valueOf(uid), statusList, param); 46 | // } 47 | // if (devId == 1) { 48 | // allOder = oderManager.getTaobaoOder(Long.valueOf(uid), statusList, param); 49 | // } 50 | // if (devId == 2) { 51 | // allOder = oderManager.getJdOder(Long.valueOf(uid), statusList, param); 52 | // } 53 | // if (devId == 3) { 54 | // allOder = oderManager.getPddOder(Long.valueOf(uid), statusList, param); 55 | // } 56 | // return ResponseUtil.success(allOder); 57 | // } 58 | // 59 | // /** 60 | // * 我的收益报表接口 61 | // * @param request 62 | // * @return 63 | // */ 64 | // @LoginRequired 65 | // @PostMapping("/InCome") 66 | // public Response queryInCome(HttpServletRequest request) { 67 | // String uid = (String) request.getAttribute(Constants.CURRENT_USER_ID); 68 | // if (uid == null) { 69 | // return ResponseUtil.fail(ResponseCode.COMMON_PARAMS_MISSING); 70 | // } 71 | // //缓存 72 | // String key = "queryInCome:" + uid; 73 | // if (redisUtil.hasKey(key)) { 74 | // return ResponseUtil.success(JSONObject.parseObject(redisUtil.get(key))); 75 | // } 76 | // JSONObject data = memberService.queryMemberDetail(Long.valueOf(uid)); 77 | // redisUtil.set(key, data.toJSONString()); 78 | // redisUtil.expire(key, 30, TimeUnit.SECONDS); 79 | // return ResponseUtil.success(data); 80 | // } 81 | //} 82 | // 83 | // 84 | // 85 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/controller/PayController.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.annotation.LoginRequired; 5 | import com.superman.superman.dao.PayDao; 6 | import com.superman.superman.service.OtherService; 7 | import com.superman.superman.utils.*; 8 | import lombok.extern.java.Log; 9 | import org.dom4j.DocumentException; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.ByteArrayOutputStream; 17 | import java.io.IOException; 18 | import java.io.InputStream; 19 | import java.io.PrintWriter; 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | /** 24 | * Created by snake on 2019/1/11. 25 | */ 26 | @Log 27 | @RestController 28 | @RequestMapping("/wx") 29 | public class PayController { 30 | @Autowired 31 | private OtherService otherService; 32 | @Autowired 33 | private PayDao payDao; 34 | /** 35 | * 微信预支付(技能开通支付) 36 | * 37 | * @param request 38 | * @throws IOException 39 | */ 40 | @LoginRequired 41 | @RequestMapping("/wechatOrderPay") 42 | public Response wechatOrderPay(HttpServletRequest request) throws IOException { 43 | String uid = (String) request.getAttribute(Constants.CURRENT_USER_ID); 44 | if (uid != null) { 45 | request.setCharacterEncoding("utf-8"); 46 | JSONObject data = otherService.payMoney(uid, request.getRemoteAddr()); 47 | return ResponseUtil.success(data); 48 | } 49 | return ResponseUtil.fail(ResponseCode.COMMON_PARAMS_MISSING); 50 | } 51 | 52 | 53 | /** 54 | * 微信付款成功!(开通技能服务) 55 | * 56 | * @throws IOException 57 | * @throws DocumentException 58 | */ 59 | @RequestMapping("/wechatBySuccess") 60 | public void wechatBySuccess(HttpServletResponse response, HttpServletRequest request) throws IOException, DocumentException { 61 | 62 | // 设置格式为text/html 63 | response.setContentType("text/html;charset=UTF-8"); 64 | PrintWriter out = response.getWriter(); 65 | InputStream inStream = request.getInputStream(); 66 | ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); 67 | byte[] buffer = new byte[1024]; 68 | int len = 0; 69 | while ((len = inStream.read(buffer)) != -1) { 70 | outSteam.write(buffer, 0, len); 71 | } 72 | outSteam.close(); 73 | inStream.close(); 74 | String result = new String(outSteam.toByteArray(), "utf-8");// 获取微信调用我们notify_url的返回信息 75 | 76 | Map resultMap = XmlUtil.doXMLParse(result); 77 | String out_trade_no = resultMap.get("out_trade_no"); 78 | String return_code = resultMap.get("return_code"); 79 | String result_code = resultMap.get("result_code"); 80 | String attach = resultMap.get("attach"); 81 | if (result_code.equalsIgnoreCase("SUCCESS")) { 82 | if (return_code.equalsIgnoreCase("SUCCESS")) { 83 | Map map = new HashMap(); 84 | map.put("id", attach); 85 | map.put("sn", out_trade_no); 86 | log.warning(EveryUtils.getNowday() + "用户付款uid为==" + attach); 87 | payDao.addPayLog(map); 88 | } else { 89 | } 90 | String ty = ""; 91 | out.write(ty); 92 | out.flush(); 93 | out.close(); 94 | } else { 95 | 96 | } 97 | 98 | 99 | } 100 | 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/controller/ShopGoodController.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.controller; 2 | 3 | import com.superman.superman.annotation.LoginRequired; 4 | import com.superman.superman.dto.GoodsDetailReq; 5 | import com.superman.superman.dto.GoodsSearchReq; 6 | import com.superman.superman.platform.CommonService; 7 | import com.superman.superman.service.TaoBaoApiService; 8 | import com.superman.superman.service.impl.PddApiServiceImpl; 9 | import com.superman.superman.utils.*; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | import org.springframework.web.client.RestTemplate; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import java.util.*; 16 | 17 | /** 18 | * Created by snake on 2018/11/8. 19 | */ 20 | @RestController 21 | @RequestMapping("/Goods") 22 | public class ShopGoodController { 23 | 24 | private List platformCommonServices; 25 | 26 | /** 27 | * 超级搜索引擎 28 | * 具体请求参数和第三方平台api文档的一致 29 | * @param 30 | * @return 31 | */ 32 | @PostMapping("/Search") 33 | public Response Search(GoodsSearchReq req) { 34 | if (this.platformCommonServices != null) { 35 | for (CommonService cs : this.platformCommonServices) { 36 | if (cs.getPlatform()==req.getPlatform()) { 37 | return ResponseUtil.success(cs.searchGoods(req)); 38 | } 39 | } 40 | } 41 | return null; 42 | } 43 | /** 44 | * 商品详情接口 45 | * @param req 46 | * @return 47 | */ 48 | @LoginRequired 49 | @GetMapping("/Detail") 50 | public Response Detail(HttpServletRequest request, GoodsDetailReq req) { 51 | // String uid = (String) request.getAttribute(Constants.CURRENT_USER_ID); 52 | // if (uid == null) { 53 | // return ResponseUtil.fail(ResponseCode.COMMON_PARAMS_MISSING); 54 | // } 55 | if (this.platformCommonServices != null) { 56 | for (CommonService cs : this.platformCommonServices) { 57 | if (cs.getPlatform()==req.getPlatform()) { 58 | return ResponseUtil.success(cs.goodDetail(req)); 59 | } 60 | } 61 | } 62 | return null; 63 | } 64 | 65 | 66 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/controller/SysAdviceController.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.alibaba.fastjson.JSONArray; 8 | import com.alibaba.fastjson.JSONObject; 9 | import com.superman.superman.dto.SysJhProblem; 10 | import com.superman.superman.dto.SysJhVideoTutorial; 11 | import com.superman.superman.dao.SysAdviceDao; 12 | import com.superman.superman.manager.ConfigQueryManager; 13 | import com.superman.superman.model.Config; 14 | import com.superman.superman.model.SysAdvice; 15 | import com.superman.superman.service.OtherService; 16 | import com.superman.superman.service.AdviceService; 17 | import com.superman.superman.utils.*; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.web.bind.annotation.*; 20 | 21 | /** 22 | * @author 23 | * @Description: 24 | * @date 2018-12-22 18:05:59 25 | */ 26 | @RestController 27 | @RequestMapping("/advice") 28 | public class SysAdviceController { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/controller/TaobaoController.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.annotation.LoginRequired; 5 | import com.superman.superman.service.TaoBaoApiService; 6 | import com.superman.superman.utils.*; 7 | import org.springframework.beans.BeanWrapper; 8 | import org.springframework.beans.PropertyAccessorFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.jdbc.core.StatementCallback; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import java.util.Optional; 15 | 16 | /** 17 | * Created by snake on 2018/12/10. 18 | */ 19 | @RestController 20 | @RequestMapping("taobao") 21 | public class TaobaoController { 22 | @Autowired 23 | private TaoBaoApiService taoBaoApiServicel; 24 | 25 | // @LoginRequired 26 | // @GetMapping("/index") 27 | // public Response index(HttpServletRequest request, TbkDgMaterialOptionalRequest taoBaoSerachBean) { 28 | // String uid = (String) request.getAttribute(Constants.CURRENT_USER_ID); 29 | // if (uid == null) { 30 | // return ResponseUtil.fail(ResponseCode.COMMON_PARAMS_MISSING); 31 | // } 32 | // if (taoBaoSerachBean.getQ() == null) { 33 | // taoBaoSerachBean.setQ(""); 34 | // } 35 | // JSONObject data = taoBaoApiServicel.serachGoodsAll(taoBaoSerachBean, Long.valueOf(uid)); 36 | // return ResponseUtil.success(data); 37 | // } 38 | // 39 | // /** 40 | // * 淘宝物料搜索引擎 41 | // * @param request 42 | // * @param taoBaoSerachBean 43 | // * @return 44 | // */ 45 | // @LoginRequired 46 | // @GetMapping("/superTaoBao") 47 | // public Response superTaoBao(HttpServletRequest request, TbkDgMaterialOptionalRequest taoBaoSerachBean) { 48 | // String uid = (String) request.getAttribute(Constants.CURRENT_USER_ID); 49 | // if (uid == null) { 50 | // return ResponseUtil.fail(ResponseCode.COMMON_PARAMS_MISSING); 51 | // } 52 | // 53 | // JSONObject data = taoBaoApiServicel.serachGoodsAll(taoBaoSerachBean, Long.valueOf(uid)); 54 | // return ResponseUtil.success(data); 55 | // } 56 | /** 57 | * 淘口令解析 58 | * 59 | * @param request 60 | * @param tkl 61 | * @return 62 | */ 63 | @LoginRequired 64 | @GetMapping("/convertTb") 65 | public Response convertTKl(HttpServletRequest request, String tkl) { 66 | String uid = (String) request.getAttribute(Constants.CURRENT_USER_ID); 67 | if (uid == null || tkl == null) { 68 | return ResponseUtil.fail(ResponseCode.COMMON_PARAMS_MISSING); 69 | } 70 | JSONObject data = taoBaoApiServicel.convertTaobaoTkl(tkl); 71 | Optional.ofNullable(data).orElseGet(JSONObject::new); 72 | return ResponseUtil.success(data); 73 | } 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/AllDevOderMapper.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.annotation.FastCache; 4 | import com.superman.superman.model.JdOder; 5 | import com.superman.superman.model.Oder; 6 | import com.superman.superman.model.Tboder; 7 | import com.superman.superman.model.Userinfo; 8 | import com.superman.superman.req.OderPdd; 9 | import org.apache.ibatis.annotations.Mapper; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.apache.ibatis.annotations.Select; 12 | 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * Created by snake on 2018/12/19. 18 | */ 19 | @Mapper 20 | public interface AllDevOderMapper { 21 | 22 | /** 23 | * 分页查询拼多多订单 24 | * @param status 25 | * @param id 26 | * @param star 27 | * @param end 28 | * @return 29 | */ 30 | @FastCache(timeOut = 10) 31 | List queryPddPageSize(@Param("status") List status, @Param("id") Long id, @Param("star") Integer star, @Param("end") Integer end); 32 | 33 | /** 34 | * 分页查询淘宝订单 35 | * @param status 36 | * @param id 37 | * @param star 38 | * @param end 39 | * @return 40 | */ 41 | @FastCache(timeOut = 10) 42 | List queryTbPageSize(@Param("tk_status") List status, @Param("id") Long id, @Param("star") Integer star, @Param("end") Integer end); 43 | /** 44 | * 分页查询京东订单 45 | * @param status 46 | * @param id 47 | * @param star 48 | * @param end 49 | * @return 50 | */ 51 | @FastCache(timeOut = 10) 52 | List queryJdPageSize(@Param("tk_status") List status, @Param("id") Long id, @Param("star") Integer star, @Param("end") Integer end); 53 | /** 54 | * 统计拼多多订单数量 55 | * @param status 56 | * @param id 57 | * @return 58 | */ 59 | Integer queryPddPageSizeCount(@Param("status") List status, @Param("id") Long id); 60 | /** 61 | * 统计淘宝订单数量 62 | * @param status 63 | * @param id 64 | * @return 65 | */ 66 | Integer queryTbPageSizeCount(@Param("tk_status") List status, @Param("id") Long id); 67 | /** 68 | * 统计京东单数量 69 | * @param map 70 | * @return 71 | */ 72 | Integer queryJdPageSizeCount(Map map); 73 | 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | /** 7 | * @author heguoliang 8 | * @Description: TODO(还需在XML文件里,有对应的SQL语句) 9 | * @date 2017-6-23 15:07 10 | */ 11 | public interface BaseDao { 12 | 13 | void save(T t); 14 | 15 | void save(Map map); 16 | 17 | void saveBatch(List list); 18 | 19 | int update(T t); 20 | 21 | int update(Map map); 22 | 23 | int delete(Object id); 24 | 25 | int delete(Map map); 26 | 27 | int deleteBatch(Object[] id); 28 | 29 | T queryObject(Object id); 30 | 31 | List queryList(Map map); 32 | 33 | List queryList(Object id); 34 | 35 | int queryTotal(Map map); 36 | 37 | int queryTotalTmall(); 38 | 39 | int queryTotalGod(); 40 | 41 | int queryTotal(); 42 | 43 | //导出数据 44 | List exportData(Map map); 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/CollectDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.CollectBean; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by snake on 2018/11/20. 12 | */ 13 | @Mapper 14 | public interface CollectDao { 15 | 16 | List query(@Param("id") Long uid,@Param("star") Integer star,@Param("end") Integer end); 17 | 18 | Integer delete(@Param("id") Long colId); 19 | 20 | @Select("select userId from collect where id=#{colId} limit 0,1" ) 21 | CollectBean querySimple(Integer colId); 22 | 23 | @Select("select count(id) from collect where userId=#{userId}") 24 | Integer count(Long userId); 25 | 26 | 27 | Integer addCollect(@Param("col") CollectBean collectBean); 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/HotUserMapper.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import org.apache.ibatis.annotations.Select; 4 | import org.apache.ibatis.annotations.Update; 5 | 6 | public interface HotUserMapper { 7 | 8 | /** 9 | * 申请拼多多推广位 10 | * @return 11 | */ 12 | @Select("select pid from jh_pid_pdd where status=0 limit 1") 13 | String createPddPid(); 14 | /** 15 | * 申请京东推广位 16 | * @return 17 | */ 18 | @Select("select pid from jh_pid_jd where status=0 limit 1") 19 | String createJdPid(); 20 | /** 21 | * 删除拼多多推广位 22 | * @return 23 | */ 24 | @Update("update jh_pid_pdd set status=1 where pid=#{pid}") 25 | Integer deletePddPid(String pid); 26 | /** 27 | * 删除京东推广位 28 | * @return 29 | */ 30 | @Update("update jh_pid_jd set status=1 where pid=#{pid}") 31 | Integer deleteJdPid(String pid); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/InvCodeDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import org.apache.ibatis.annotations.Insert; 4 | import org.apache.ibatis.annotations.Select; 5 | 6 | public interface InvCodeDao { 7 | /** 8 | * 新增邀请码 9 | * @param id 10 | * @return 11 | */ 12 | @Insert("insert into invcode(userId,createTime) values (#{id},now())") 13 | Integer insertCode(Long id); 14 | /** 15 | * 查询邀请码是否存在 16 | * @param id 17 | * @return 18 | */ 19 | @Select("select ifnull(id,0) from invcode where userId=#{id}") 20 | Integer queryCodeId(Long id); 21 | 22 | /** 23 | * 根据邀请码查询 24 | * @param id 25 | * @return 26 | */ 27 | @Select("select userId from invcode where id=#{id}") 28 | Integer queryUserCode(Long id); 29 | 30 | @Select("select id from invcode where userId=#{id}") 31 | Integer queryInvCodeId(Long id); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/LogDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.superman.superman.model.UserLog; 5 | 6 | /** 7 | * Created by snake on 2018/11/24. 8 | */ 9 | public interface LogDao extends BaseMapper { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/OderMapper.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.dto.MemberDetail; 4 | import com.superman.superman.model.Oder; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | @Mapper 13 | public interface OderMapper { 14 | 15 | /** 16 | * 超级统计所有 平台未结算订单(只需要传入用户id 支持多用户id传入) 17 | * 18 | * @param list 19 | * @return 20 | */ 21 | Long queryForAllOrderListToWait(@Param("list") List list, @Param("devId") Integer devId); 22 | 23 | /** 24 | * 超级统计所有 平台已结算订单(只需要传入用户id 支持多用户id传入) 25 | * 26 | * @param list 27 | * @param devId 28 | * @return 29 | */ 30 | Long queryForAllOrderListToFinsh(@Param("list") List list, @Param("devId") Integer devId); 31 | 32 | @Select(" select SUM(s.money) as money, SUM(s.counts) as sums FROM(" + 33 | "SELECT IFNULL(SUM(tb.pub_share_pre_fee),0)*100 as money,COUNT(tb.id) as counts FROM tboder tb " + 34 | "left join userinfo u on tb.relation_id=u.rid\n" + 35 | "WHERE u.id=#{id} and tb.tk_status in ('3','12','14') and tb.odercreate_time between #{tbstartTime} and #{tbendTime} " + 36 | "UNION \n" + 37 | "SELECT IFNULL(SUM(tb.promotion_amount),0) as money ,COUNT(tb.id) as counts FROM\n" + 38 | "oder tb" + 39 | " left join userinfo u on tb.p_id=u.pddPid WHERE u.id=#{id} and tb.order_create_time between #{pddstartTime} and #{pddendTime} and tb.order_status in (0,1,2,3,5)" + 40 | " UNION SELECT IFNULL(SUM(jd.estimateFee),0)*100 as money ,count(jd.id) as counts FROM jdoder jd left join userinfo u on jd.positionId=u.jdPid WHERE u.id=#{id} and jd.orderTime between #{jdstartTime} and #{jdendTime} and jd.validCode in (16,17,18) ) as s") 41 | MemberDetail sumAllDevOderByOderCreateTimeForMb(@Param("id") Integer id, @Param("tbstartTime") String tbstartTime, @Param("tbendTime") String tbendTime, @Param("pddstartTime") Long pddstartTime, @Param("pddendTime") Long pddendTime, @Param("jdstartTime") Long jdstartTime, @Param("jdendTime") Long jdendTime); 42 | 43 | 44 | MemberDetail sumAllDevOderByOderCreateTimeForAgent(@Param("list") List list, @Param("tbstartTime") String tbstartTime, @Param("tbendTime") String tbendTime, 45 | @Param("pddstartTime") Long pddstartTime, @Param("pddendTime") Long pddendTime, 46 | @Param("jdstartTime") Long jdstartTime, @Param("jdendTime") Long jdendTime); 47 | 48 | MemberDetail sumAllDevOderByOderCreateTimeForAgentToSettle(@Param("list") List list, @Param("tbstartTime") String tbstartTime, @Param("tbendTime") String tbendTime, 49 | @Param("pddstartTime") Long pddstartTime, @Param("pddendTime") Long pddendTime, 50 | @Param("jdstartTime") Long jdstartTime, @Param("jdendTime") Long jdendTime); 51 | 52 | MemberDetail sumAllDevAllOder(@Param("list") List list); 53 | 54 | MemberDetail sumAllDevOderByOderCreateTimeForAgentGroup(@Param("list") List list, @Param("tbstartTime") String tbstartTime, @Param("tbendTime") String tbendTime, 55 | @Param("pddstartTime") Long pddstartTime, @Param("pddendTime") Long pddendTime, 56 | @Param("jdstartTime") Long jdstartTime, @Param("jdendTime") Long jdendTime); 57 | 58 | Integer countOpenOderForAgentGroupCreateTime(@Param("list") List list, @Param("tbstartTime") String tbstartTime, @Param("tbendTime") String tbendTime, 59 | @Param("pddstartTime") Long pddstartTime, @Param("pddendTime") Long pddendTime, 60 | @Param("jdstartTime") Long jdstartTime, @Param("jdendTime") Long jdendTime); 61 | 62 | 63 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/OrderSuperDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.Tboder; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 专门统计各平台订单的dao 11 | */ 12 | public interface OrderSuperDao { 13 | /** 14 | * 批量统计所以平台订单佣金(预估) 15 | * @param list 16 | * @return 17 | */ 18 | Integer queryAllDevOrder(@Param("list") List list, @Param("devId") Integer devId); 19 | 20 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/PayDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import org.apache.ibatis.annotations.Insert; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.Map; 8 | 9 | @Mapper 10 | public interface PayDao { 11 | /** 12 | * 运营商付款申请成功记录 13 | * 14 | * @param map 15 | * @return 16 | */ 17 | @Insert("insert into jh_pay_log(userId,orderSn,accept,createTime) value (#{id},#{sn},0,now())") 18 | Integer addPayLog(Map map); 19 | 20 | /** 21 | * 查看会员支付状态 22 | * 23 | * @param id 24 | * @return 25 | */ 26 | @Select("select accept from jh_pay_log where userId=#{id} limit 1") 27 | Integer queryAccept(Integer id); 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/ScoreDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.ScoreBean; 4 | import com.superman.superman.model.Userinfo; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | import org.apache.ibatis.annotations.Update; 9 | 10 | /** 11 | * Created by snake on 2018/11/15. 12 | */ 13 | @Mapper 14 | public interface ScoreDao { 15 | /** 16 | * 查询是否领取过每日商品浏览积分 17 | * 18 | * @param user 19 | * @return 20 | */ 21 | ScoreBean isExit(@Param("score") ScoreBean user); 22 | 23 | /** 24 | * 增加积分 25 | * 26 | * @param user 27 | * @return 28 | */ 29 | Integer addScore(@Param("score") ScoreBean user); 30 | 31 | /** 32 | * 统计积分 33 | * 34 | * @param uid 35 | * @return 36 | */ 37 | @Select("select userScore from userinfo where id=#{uid} and status=0") 38 | Integer countScore(Long uid); 39 | 40 | /** 41 | * 积分提现 42 | * @param user 43 | * @return 44 | */ 45 | @Update("update userinfo set cash=cash+ #{cash} where id=#{id}") 46 | Integer updateCash(Userinfo user); 47 | 48 | /** 49 | * 积分减少0 50 | * @param user 51 | * @return 52 | */ 53 | @Update("update userinfo set userScore=0 where id=#{id}") 54 | Integer updateScoreZero(Userinfo user); 55 | 56 | /** 57 | * 增加用户积分 58 | * @param user 59 | * @return 60 | */ 61 | @Update("update userinfo set userScore=userScore+#{userscore} where id=#{id}") 62 | Integer updateUserScore(Userinfo user); 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/SettingDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.Config; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Select; 6 | 7 | import java.util.List; 8 | @Mapper 9 | public interface SettingDao { 10 | 11 | /** 12 | * 配置查找 13 | * @return 14 | */ 15 | @Select("select * from jh_config where ConfigNo=#{no}") 16 | Config querySetting(String no); 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/SysAdviceDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.dto.SysJhProblem; 4 | import com.superman.superman.dto.SysJhVideoTutorial; 5 | import com.superman.superman.model.*; 6 | import org.apache.ibatis.annotations.Insert; 7 | import org.apache.ibatis.annotations.Mapper; 8 | import org.apache.ibatis.annotations.Param; 9 | import org.apache.ibatis.annotations.Select; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | @Mapper 15 | public interface SysAdviceDao extends BaseDao { 16 | 17 | /** 18 | * 新增提现申请 19 | * @param applyCash 20 | * @return 21 | */ 22 | @Insert("insert into jh_cash_apply (`userId`, `money`, `audit`, `createtime`, `roleid` )value(#{userid},#{money}, 0,now(),#{roleid}) ") 23 | Integer applyCash(ApplyCash applyCash); 24 | 25 | 26 | /** 27 | * 查询提现申请记录 28 | * 29 | * @return 30 | */ 31 | @Select("select * from jh_cash_apply where userId=#{uid} limit #{offset}, #{limit} ") 32 | List queryApplyCash(Map map); 33 | 34 | /** 35 | * 查询官方通知 36 | * 37 | * @return 38 | */ 39 | @Select("select * from jh_advice_dev limit #{offset}, #{limit} ") 40 | List queryAdviceDev(Map map); 41 | 42 | /** 43 | * 轮播图 44 | * 45 | * @return 46 | */ 47 | @Select("select * from jh_banner_good order by id limit 3") 48 | List queryBannerGoods(); 49 | 50 | /** 51 | * 查询常见问题 52 | * 53 | * @return 54 | */ 55 | @Select("select * from jh_problem limit #{offset}, #{limit} ") 56 | List querySysJhProblem(Map map); 57 | 58 | /** 59 | * 查询视频教程 60 | * 61 | * @param offset 62 | * @param limit 63 | * @return 64 | */ 65 | @Select("select * from jh_video_tutorial limit #{offset}, #{limit} ") 66 | List querySysJhVideoTutorial(@Param("offset") Integer offset, @Param("limit") Integer limit); 67 | 68 | /** 69 | * 统计常见问题数量 70 | * 71 | * @return 72 | */ 73 | @Select("select count(id) from jh_problem ") 74 | Integer countProblem(); 75 | 76 | /** 77 | * 统计视频教程数量 78 | * 79 | * @return 80 | */ 81 | @Select("select count(id) from jh_video_tutorial ") 82 | Integer countTutorial(); 83 | 84 | /** 85 | * 统计官方通知的数量 86 | * 87 | * @return 88 | */ 89 | @Select("select count(id) from jh_advice_dev") 90 | Integer countAdvSum(); 91 | 92 | 93 | /** 94 | * 查询订单通知(传入uid列表)分页 95 | * 96 | * @return 97 | */ 98 | List querySysOderAdvice(@Param("list") List list, @Param("offset") Integer offset, @Param("limit") Integer limit); 99 | 100 | /** 101 | * 统计订单通知的数量(传入uid列表) 102 | * 103 | * @return 104 | */ 105 | Integer countSysOderAdvice(@Param("list") List list); 106 | 107 | 108 | // /** 109 | // * 查询订单通知 代理或者粉丝 110 | // * @param uid 111 | // * @param offset 112 | // * @param limit 113 | // * @return 114 | // */ 115 | // @Select("select * from jh_cash_apply where userId=#{uid} limit #{offset}, #{limit} ") 116 | // List queryOderAdvice(@Param("uid") Integer uid, @Param("offset") Integer offset, @Param("limit") Integer limit); 117 | 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/SysDaygoodsDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.SysDaygoods; 4 | import com.superman.superman.model.SysJhImage; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | import java.util.List; 10 | 11 | @Mapper 12 | public interface SysDaygoodsDao extends BaseDao { 13 | /** 14 | * 每日爆款查询 15 | * 16 | * @param page 17 | * @param pageSize 18 | * @return 19 | */ 20 | @Select("select * from jh_day_goods order by createtime desc limit #{page}, #{pageSize} ") 21 | List queryListGod(@Param("page") Integer page, @Param("pageSize") Integer pageSize); 22 | 23 | /** 24 | * 每日爆款统计 25 | * @return 26 | */ 27 | @Select("select IFNULL(count(*),0) from jh_day_goods") 28 | Integer countDayGoods(); 29 | 30 | /** 31 | * 获取每日爆款的图片 32 | * @param id 33 | * @return 34 | */ 35 | @Select("select image from jh_day_image where day=#{id}") 36 | List getImages(Integer id); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/SysFriendDtoMapper.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.SysJhTaobaoAll; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | import com.superman.superman.dto.SysFriendDto; 9 | import org.apache.ibatis.annotations.Select; 10 | import org.apache.ibatis.annotations.Update; 11 | 12 | @Mapper 13 | public interface SysFriendDtoMapper { 14 | /** 15 | * 16 | * @param page 17 | * @param pageSize 18 | * @return 19 | */ 20 | @Select("select * from jh_friend_dto order by createTime desc limit #{page}, #{pageSize}") 21 | List queryListGod(@Param("page")Integer page, @Param("pageSize")Integer pageSize); 22 | /** 23 | *随机选中商品 24 | * @return 25 | */ 26 | @Select("select numiid from jh_taobao_all order by rand() limit 3") 27 | List random(); 28 | /** 29 | * 30 | * @param page 31 | * @param pageSize 32 | * @return 33 | */ 34 | @Select("select * from jh_friend_dto order by createTime desc limit #{page}, #{pageSize}") 35 | List queryListFriend(@Param("page")Integer page, @Param("pageSize")Integer pageSize); 36 | /** 37 | * 38 | * @return 39 | */ 40 | @Select("select count(*) from jh_friend_dto") 41 | Integer count(); 42 | /** 43 | * 44 | * @return 45 | */ 46 | @Select("select image from jh_friend_image where day=#{id}") 47 | List getImages(Integer id); 48 | @Update("update jh_friend_dto set goodIds=#{content} where id=#{id}") 49 | void updateRandom(@Param("id") Integer id,@Param("content") String content); 50 | 51 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/SysJhPddAllDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.SysJhPddAll; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | @Mapper 10 | public interface SysJhPddAllDao extends BaseDao { 11 | List queryPageJd(Map map); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/SysJhTaobaoHotDao.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.model.SysJhJdHot; 4 | import com.superman.superman.model.SysJhTaobaoAll; 5 | import com.superman.superman.model.SysJhTaobaoHot; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Select; 8 | import org.apache.ibatis.annotations.Update; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | @Mapper 14 | public interface SysJhTaobaoHotDao extends BaseDao { 15 | 16 | /** 17 | * 京东本地搜索引擎 18 | * @return 19 | */ 20 | 21 | List queryPageJd(Map map); 22 | 23 | /** 24 | * 淘宝本地搜索引擎 25 | * @param map 26 | * @return 27 | */ 28 | 29 | List queryLocalAllOpt(Map map); 30 | 31 | /** 32 | * 淘宝本地搜索引擎 统计数量 33 | * @param map 34 | * @return 35 | */ 36 | Integer countLocalAllOpt(Map map); 37 | 38 | /** 39 | * 京东统计 40 | * 41 | * @return 42 | */ 43 | Integer countMaxJd(); 44 | 45 | /** 46 | * 京东统计(类目) 47 | * 48 | * @return 49 | */ 50 | Integer countMaxJdCid(Integer cid); 51 | 52 | /** 53 | * 轮播图商品搜索 54 | * 55 | * @return 56 | */ 57 | @Select("SELECT * FROM jh_taobao_all where numIid=#{goodId} and status=0 limit 1") 58 | SysJhTaobaoAll queryLocalSimple(Long goodId); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.superman.superman.model.User; 5 | import com.superman.superman.model.UserLog; 6 | 7 | /** 8 | * Created by snake on 2019/12/18. 9 | */ 10 | public interface UserMapper extends BaseMapper { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dao/UserinfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dao; 2 | 3 | import com.superman.superman.req.UpdateWxOpenId; 4 | import com.superman.superman.model.Userinfo; 5 | import org.apache.ibatis.annotations.*; 6 | 7 | import java.util.List; 8 | import java.util.Optional; 9 | 10 | @Mapper 11 | public interface UserinfoMapper { 12 | /** 13 | * @param id 14 | * @return 15 | */ 16 | Userinfo selectByPrimaryKey(Long id); 17 | 18 | Optional selectByPhone(String userPhone); 19 | 20 | @Select("select id,userPhone,rid,spid from userinfo where wxOpenId=#{id} limit 1") 21 | Userinfo queryUserWxOpenId(String id); 22 | 23 | 24 | @Select("select roleId from userinfo where id=#{id} limit 1") 25 | Integer queryMyRole(Integer id); 26 | 27 | /** 28 | * 手机号码绑定用户微信Id 29 | * 30 | * @param uu 31 | * @return 32 | */ 33 | @Update("update userinfo set wxOpenId=#{id},userName=#{name},userPhoto=#{photo} where userPhone=#{phone}") 34 | Integer updateUserWxOpenId(UpdateWxOpenId uu); 35 | 36 | /** 37 | * 渠道更新 38 | * 39 | * @param userinfo 40 | * @return 41 | */ 42 | @Update("update userinfo set rid=#{rid} where id=#{id}") 43 | Integer updateUserForRid(Userinfo userinfo); 44 | 45 | /** 46 | * 更新PID 47 | * 48 | * @param userinfo 49 | * @return 50 | */ 51 | @Update("update userinfo set pid=#{pid},tree=#{tree} where id=#{id}") 52 | Integer updatePid(Userinfo userinfo); 53 | 54 | /** 55 | * 渠道检查 56 | * 57 | * @param rid 58 | * @return 59 | */ 60 | @Select("select id from userinfo where rid=#{rid} limit 1") 61 | Integer relationIdExits(String rid); 62 | 63 | @Select("select id,userName,createTime,userPhone,roleId from userinfo where id in (SELECT userId FROM agent WHERE agentId= #{agentId} and status=0) and status=0 ORDER by roleId asc limit #{star},#{end}") 64 | List selectInUserInfoForAgentId(@Param("agentId") Long agentId, @Param("star") Integer star, @Param("end") Integer end); 65 | 66 | 67 | @Insert("insert into invcode(userId,createTime) values (#{id},now())") 68 | Optional insertCode(Long id); 69 | 70 | @Select("select ifnull(id,0) from invcode where userId=#{id}") 71 | Integer queryCodeId(Long id); 72 | 73 | @Select("select userId from invcode where id=#{id}") 74 | Integer queryUserCode(Long id); 75 | 76 | @Select("select id from invcode where userId=#{id}") 77 | Integer queryInvCodeId(Long id); 78 | 79 | 80 | @Select("select pid from userinfo where id=#{id} limit 1") 81 | Integer querypid(Integer id); 82 | 83 | 84 | Optional queryUserInfoSingle(Userinfo userinfo); 85 | 86 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/CollectBeanDto.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | @Data 7 | public class CollectBeanDto { 8 | private Integer id; 9 | private Long userId; 10 | private Long goodId; 11 | private String title; 12 | private String image; 13 | private Integer src; 14 | private Integer volume; 15 | private Double price; 16 | private Double coupon_price; 17 | private Long promotion_rate; 18 | private Long coupon; 19 | private Date createTime; 20 | private Date updateTime; 21 | private Double agent; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/GoodsDetailReq.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import com.superman.superman.model.enums.Platform; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import org.hibernate.validator.constraints.NotBlank; 7 | 8 | import javax.validation.constraints.NotNull; 9 | 10 | @ApiModel 11 | public class GoodsDetailReq { 12 | @ApiModelProperty("商品id") 13 | private String goodId; 14 | @ApiModelProperty("来源") 15 | private Platform platform; 16 | 17 | public String getGoodId() { 18 | return goodId; 19 | } 20 | 21 | public GoodsDetailReq setGoodId(String goodId) { 22 | this.goodId = goodId; 23 | return this; 24 | } 25 | 26 | public Platform getPlatform() { 27 | return platform; 28 | } 29 | 30 | public GoodsDetailReq setPlatform(Platform platform) { 31 | this.platform = platform; 32 | return this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/GoodsDetailResponse.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import com.superman.superman.model.enums.Platform; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.List; 9 | 10 | @ApiModel 11 | public class GoodsDetailResponse { 12 | @ApiModelProperty("来源") 13 | private Platform platform; 14 | @ApiModelProperty("商品名") 15 | private String goodName; 16 | @ApiModelProperty("排序") 17 | private String sort; 18 | @ApiModelProperty("是否优惠券") 19 | private Integer hasCoupon; 20 | @ApiModelProperty("售价") 21 | private BigDecimal price; 22 | 23 | public Platform getPlatform() { 24 | return platform; 25 | } 26 | 27 | public GoodsDetailResponse setPlatform(Platform platform) { 28 | this.platform = platform; 29 | return this; 30 | } 31 | 32 | public String getGoodName() { 33 | return goodName; 34 | } 35 | 36 | public GoodsDetailResponse setGoodName(String goodName) { 37 | this.goodName = goodName; 38 | return this; 39 | } 40 | 41 | public String getSort() { 42 | return sort; 43 | } 44 | 45 | public GoodsDetailResponse setSort(String sort) { 46 | this.sort = sort; 47 | return this; 48 | } 49 | 50 | public Integer getHasCoupon() { 51 | return hasCoupon; 52 | } 53 | 54 | public GoodsDetailResponse setHasCoupon(Integer hasCoupon) { 55 | this.hasCoupon = hasCoupon; 56 | return this; 57 | } 58 | 59 | public BigDecimal getPrice() { 60 | return price; 61 | } 62 | 63 | public GoodsDetailResponse setPrice(BigDecimal price) { 64 | this.price = price; 65 | return this; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/GoodsSearchReq.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import com.superman.superman.model.enums.Platform; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import org.hibernate.validator.constraints.NotBlank; 7 | 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotNull; 10 | 11 | @ApiModel 12 | public class GoodsSearchReq { 13 | @ApiModelProperty("关键词") 14 | private String keyword; 15 | @ApiModelProperty("排序") 16 | private String sort; 17 | @ApiModelProperty("是否优惠券") 18 | private String hasCoupon; 19 | @NotNull 20 | private Integer pageSize; 21 | @NotNull 22 | private Integer pageNo; 23 | @NotNull 24 | @NotBlank 25 | @ApiModelProperty("来源") 26 | private Platform platform; 27 | 28 | private String tbcat; 29 | 30 | private Integer cid; 31 | 32 | private Long opt; 33 | 34 | public String getTbcat() { 35 | return tbcat; 36 | } 37 | 38 | public GoodsSearchReq setTbcat(String tbcat) { 39 | this.tbcat = tbcat; 40 | return this; 41 | } 42 | 43 | public Integer getCid() { 44 | return cid; 45 | } 46 | 47 | public GoodsSearchReq setCid(Integer cid) { 48 | this.cid = cid; 49 | return this; 50 | } 51 | 52 | public Long getOpt() { 53 | return opt; 54 | } 55 | 56 | public GoodsSearchReq setOpt(Long opt) { 57 | this.opt = opt; 58 | return this; 59 | } 60 | 61 | public Platform getPlatform() { 62 | return platform; 63 | } 64 | 65 | public GoodsSearchReq setPlatform(Platform platform) { 66 | this.platform = platform; 67 | return this; 68 | } 69 | 70 | public String getKeyword() { 71 | return keyword; 72 | } 73 | 74 | public GoodsSearchReq setKeyword(String keyword) { 75 | this.keyword = keyword; 76 | return this; 77 | } 78 | 79 | public String getSort() { 80 | return sort; 81 | } 82 | 83 | public GoodsSearchReq setSort(String sort) { 84 | this.sort = sort; 85 | return this; 86 | } 87 | 88 | public String getHasCoupon() { 89 | return hasCoupon; 90 | } 91 | 92 | public GoodsSearchReq setHasCoupon(String hasCoupon) { 93 | this.hasCoupon = hasCoupon; 94 | return this; 95 | } 96 | 97 | public Integer getPageSize() { 98 | return pageSize; 99 | } 100 | 101 | public GoodsSearchReq setPageSize(Integer pageSize) { 102 | this.pageSize = pageSize; 103 | return this; 104 | } 105 | 106 | public Integer getPageNo() { 107 | return pageNo; 108 | } 109 | 110 | public GoodsSearchReq setPageNo(Integer pageNo) { 111 | this.pageNo = pageNo; 112 | return this; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/GoodsSearchResponse.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import com.superman.superman.model.enums.Platform; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.List; 9 | 10 | @ApiModel 11 | public class GoodsSearchResponse { 12 | 13 | private List goodsDetailList; 14 | 15 | private Integer pageSize; 16 | 17 | private Integer pageNo; 18 | 19 | private Integer totalCount; 20 | 21 | @ApiModelProperty("来源") 22 | private Platform platform; 23 | 24 | 25 | public static class GoodDetail { 26 | @ApiModelProperty("商品名") 27 | private String goodName; 28 | @ApiModelProperty("排序") 29 | private String sort; 30 | @ApiModelProperty("是否优惠券") 31 | private Integer hasCoupon; 32 | @ApiModelProperty("售价") 33 | private BigDecimal price; 34 | 35 | public String getGoodName() { 36 | return goodName; 37 | } 38 | 39 | public GoodDetail setGoodName(String goodName) { 40 | this.goodName = goodName; 41 | return this; 42 | } 43 | 44 | public String getSort() { 45 | return sort; 46 | } 47 | 48 | public GoodDetail setSort(String sort) { 49 | this.sort = sort; 50 | return this; 51 | } 52 | 53 | public Integer getHasCoupon() { 54 | return hasCoupon; 55 | } 56 | 57 | public GoodDetail setHasCoupon(Integer hasCoupon) { 58 | this.hasCoupon = hasCoupon; 59 | return this; 60 | } 61 | 62 | public BigDecimal getPrice() { 63 | return price; 64 | } 65 | 66 | public GoodDetail setPrice(BigDecimal price) { 67 | this.price = price; 68 | return this; 69 | } 70 | } 71 | 72 | public List getGoodsDetailList() { 73 | return goodsDetailList; 74 | } 75 | 76 | public GoodsSearchResponse setGoodsDetailList(List goodsDetailList) { 77 | this.goodsDetailList = goodsDetailList; 78 | return this; 79 | } 80 | 81 | public Integer getPageSize() { 82 | return pageSize; 83 | } 84 | 85 | public GoodsSearchResponse setPageSize(Integer pageSize) { 86 | this.pageSize = pageSize; 87 | return this; 88 | } 89 | 90 | public Integer getTotalCount() { 91 | return totalCount; 92 | } 93 | 94 | public GoodsSearchResponse setTotalCount(Integer totalCount) { 95 | this.totalCount = totalCount; 96 | return this; 97 | } 98 | public Integer getPageNo() { 99 | return pageNo; 100 | } 101 | 102 | public GoodsSearchResponse setPageNo(Integer pageNo) { 103 | this.pageNo = pageNo; 104 | return this; 105 | } 106 | 107 | public Platform getPlatform() { 108 | return platform; 109 | } 110 | 111 | public GoodsSearchResponse setPlatform(Platform platform) { 112 | this.platform = platform; 113 | return this; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/MemberDetail.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | /** 8 | * Created by snake on 2018/12/28. 9 | */ 10 | @Setter 11 | @ToString 12 | @Getter 13 | public class MemberDetail { 14 | private Integer money; 15 | private Integer sums; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/SysDayGoodDto.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import com.superman.superman.model.SysJhImage; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by snake on 2019/1/12. 14 | */ 15 | @Setter 16 | @ToString 17 | @Getter 18 | public class SysDayGoodDto implements Serializable { 19 | 20 | // 21 | private Integer id; 22 | //标题 23 | private String titile; 24 | //内容 25 | private String content; 26 | //头像 27 | private String image; 28 | //图片内容url数组 29 | private List content_Images; 30 | //删除状态 31 | private Integer status; 32 | //创建时间 33 | private Date createtime; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/SysFriendDto.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by snake on 2019/1/12. 13 | */ 14 | @Setter 15 | @ToString 16 | @Getter 17 | public class SysFriendDto implements Serializable { 18 | private Integer id; 19 | //标题 20 | private String titile; 21 | //内容 22 | private String content; 23 | //头像 24 | private String image; 25 | //商品 26 | private String goodIds; 27 | //图片内容url数组 28 | private List content_Images; 29 | //删除状态 30 | private Integer status; 31 | //创建时间 32 | private Date createtime; 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/SysJhProblem.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | /** 7 | * @author heguoliang 8 | * @Description: (常见问题) 9 | * @date 2019-01-09 16:28:57 10 | */ 11 | public class SysJhProblem implements Serializable { 12 | 13 | // 14 | private Integer id; 15 | //详情文章 16 | private String detail; 17 | //标题 18 | private String title; 19 | //删除状态 20 | private Integer status; 21 | //创建时间 22 | private Date createtime; 23 | 24 | /** 25 | * 设置: 26 | */ 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | /** 31 | * 获取: 32 | */ 33 | public Integer getId() { 34 | return id; 35 | } 36 | /** 37 | * 设置:详情文章 38 | */ 39 | public void setDetail(String detail) { 40 | this.detail = detail; 41 | } 42 | /** 43 | * 获取:详情文章 44 | */ 45 | public String getDetail() { 46 | return detail; 47 | } 48 | /** 49 | * 设置:标题 50 | */ 51 | public void setTitle(String title) { 52 | this.title = title; 53 | } 54 | /** 55 | * 获取:标题 56 | */ 57 | public String getTitle() { 58 | return title; 59 | } 60 | /** 61 | * 设置:删除状态 62 | */ 63 | public void setStatus(Integer status) { 64 | this.status = status; 65 | } 66 | /** 67 | * 获取:删除状态 68 | */ 69 | public Integer getStatus() { 70 | return status; 71 | } 72 | /** 73 | * 设置:创建时间 74 | */ 75 | public void setCreatetime(Date createtime) { 76 | this.createtime = createtime; 77 | } 78 | /** 79 | * 获取:创建时间 80 | */ 81 | public Date getCreatetime() { 82 | return createtime; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/SysJhVideoTutorial.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | /** 7 | * @author heguoliang 8 | * @Description: TODO(视频教程) 9 | * @date 2019-01-09 16:28:58 10 | */ 11 | public class SysJhVideoTutorial implements Serializable { 12 | 13 | // 14 | private Integer id; 15 | //视频URL地址 16 | private String video; 17 | //视频标题 18 | private String title; 19 | //删除状态 20 | private Integer status; 21 | //创建时间 22 | private Date createtime; 23 | 24 | /** 25 | * 设置: 26 | */ 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | /** 31 | * 获取: 32 | */ 33 | public Integer getId() { 34 | return id; 35 | } 36 | /** 37 | * 设置:视频URL地址 38 | */ 39 | public void setVideo(String video) { 40 | this.video = video; 41 | } 42 | /** 43 | * 获取:视频URL地址 44 | */ 45 | public String getVideo() { 46 | return video; 47 | } 48 | /** 49 | * 设置:视频标题 50 | */ 51 | public void setTitle(String title) { 52 | this.title = title; 53 | } 54 | /** 55 | * 获取:视频标题 56 | */ 57 | public String getTitle() { 58 | return title; 59 | } 60 | /** 61 | * 设置:删除状态 62 | */ 63 | public void setStatus(Integer status) { 64 | this.status = status; 65 | } 66 | /** 67 | * 获取:删除状态 68 | */ 69 | public Integer getStatus() { 70 | return status; 71 | } 72 | /** 73 | * 设置:创建时间 74 | */ 75 | public void setCreatetime(Date createtime) { 76 | this.createtime = createtime; 77 | } 78 | /** 79 | * 获取:创建时间 80 | */ 81 | public Date getCreatetime() { 82 | return createtime; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/dto/UserCreateReq.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.dto; 2 | 3 | import org.hibernate.validator.constraints.NotBlank; 4 | 5 | import javax.validation.constraints.Pattern; 6 | 7 | public class UserCreateReq { 8 | @NotBlank(message = "手机号不能为空") 9 | @Pattern(regexp = "^(((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(16[6])|(17[0135678])|(18[0-9])|(19[89]))\\d{8})$", message = "手机号格式错误") 10 | private String phone; 11 | @NotBlank(message = "验证码不能为空") 12 | private String authCode; 13 | 14 | public String getPhone() { 15 | return phone; 16 | } 17 | 18 | public UserCreateReq setPhone(String phone) { 19 | this.phone = phone; 20 | return this; 21 | } 22 | 23 | public String getAuthCode() { 24 | return authCode; 25 | } 26 | 27 | public UserCreateReq setAuthCode(String authCode) { 28 | this.authCode = authCode; 29 | return this; 30 | } 31 | 32 | public String getInviteCode() { 33 | return inviteCode; 34 | } 35 | 36 | public UserCreateReq setInviteCode(String inviteCode) { 37 | this.inviteCode = inviteCode; 38 | return this; 39 | } 40 | 41 | private String inviteCode; 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/event/CreateUserEvent.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.event; 2 | 3 | import com.superman.superman.dto.UserCreateReq; 4 | import com.superman.superman.model.User; 5 | import org.springframework.context.ApplicationEvent; 6 | 7 | public class CreateUserEvent extends ApplicationEvent { 8 | private static final long serialVersionUID = 4385004033026265719L; 9 | 10 | private final UserCreateReq user; 11 | 12 | public CreateUserEvent(Object source, UserCreateReq user) { 13 | super(source); 14 | this.user = user; 15 | } 16 | 17 | public UserCreateReq getUser() { 18 | return user; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/manager/ConfigQueryManager.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.manager; 2 | 3 | import com.superman.superman.dao.SettingDao; 4 | import com.superman.superman.redis.RedisUtil; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.concurrent.TimeUnit; 9 | 10 | @Service("configQueryManager") 11 | public class ConfigQueryManager { 12 | @Autowired 13 | private SettingDao settingDao; 14 | @Autowired 15 | private RedisUtil redisUtil; 16 | 17 | /** 18 | * 配置文件 查找 19 | * @param value 20 | * @return 21 | */ 22 | public String queryForKey(String value) { 23 | //缓存 24 | String key = "queryForKey:" + value; 25 | if (redisUtil.hasKey(key)) { 26 | return redisUtil.get(key); 27 | } 28 | String config = settingDao.querySetting(key).getConfigValue(); 29 | redisUtil.set(key, config); 30 | redisUtil.expire(key, 60, TimeUnit.SECONDS); 31 | return config; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/manager/UserManager.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.manager; 2 | 3 | import com.superman.superman.service.impl.UserServiceImpl; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * 用户缓存层 9 | */ 10 | @Service("userManager") 11 | public class UserManager { 12 | @Autowired 13 | private UserServiceImpl userApiService; 14 | 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/Agent.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Data; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.util.Date; 9 | 10 | /** 代理表 11 | * Created by snake on 2018/11/23. 12 | */ 13 | @Data 14 | public class Agent { 15 | private Integer id; 16 | private Integer userId; 17 | private Integer agentId; 18 | private String agentName; 19 | private String userName; 20 | private Date createTime; 21 | private Date updateTime; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/ApplyCash.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.util.Date; 7 | 8 | /** 9 | * @author ljp 10 | * @Description: TODO(提现申请表) 11 | * @date 2019-01-09 10:57:38 12 | */ 13 | @Data 14 | public class ApplyCash extends BaseBean implements Serializable { 15 | //用户id 16 | private Integer userid; 17 | //提现金额 18 | private Long money; 19 | //处理状态 0处理中 1提现完成 2提现失败 20 | private Integer audit; 21 | public Integer getRoleid() { 22 | return roleid; 23 | } 24 | 25 | public void setRoleid(Integer roleid) { 26 | this.roleid = roleid; 27 | } 28 | 29 | private Integer roleid; 30 | //更新 31 | private String account; 32 | 33 | 34 | //更新 35 | private String name; 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/BannerGoods.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Data; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * Created by snake on 2019/1/8. 12 | */ 13 | @Data 14 | public class BannerGoods extends BaseBean { 15 | //商品id 16 | private Long goodId; 17 | //平台来源 18 | private Integer src; 19 | 20 | private String imgUrl; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/BaseBean.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | import com.baomidou.mybatisplus.annotation.FieldFill; 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | 6 | import java.io.Serializable; 7 | import java.time.Instant; 8 | 9 | /** 10 | * Created by snake on 2018/11/5. 11 | */ 12 | public class BaseBean implements Serializable { 13 | @TableField(value = "create_time", fill = FieldFill.INSERT) 14 | public Instant createTime; 15 | 16 | @TableField(value = "update_Time", fill = FieldFill.INSERT_UPDATE) 17 | public Instant updateTime; 18 | 19 | @TableField(value = "status", fill = FieldFill.INSERT) 20 | public Boolean status; 21 | 22 | public Instant getCreateTime() { 23 | return createTime; 24 | } 25 | 26 | public BaseBean setCreateTime(Instant createTime) { 27 | this.createTime = createTime; 28 | return this; 29 | } 30 | 31 | public Instant getUpdateTime() { 32 | return updateTime; 33 | } 34 | 35 | public BaseBean setUpdateTime(Instant updateTime) { 36 | this.updateTime = updateTime; 37 | return this; 38 | } 39 | 40 | public Boolean getStatus() { 41 | return status; 42 | } 43 | 44 | public BaseBean setStatus(Boolean status) { 45 | this.status = status; 46 | return this; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/CollectBean.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by snake on 2018/11/20. 11 | */ 12 | @ToString 13 | @Setter 14 | @Getter 15 | public class CollectBean { 16 | private Integer id; 17 | private Long userId; 18 | private Long goodId; 19 | private String title; 20 | private String image; 21 | private Integer src; 22 | private Integer volume; 23 | private Double price; 24 | private Double coupon_price; 25 | private Long promotion_rate; 26 | private Long coupon; 27 | private Date createTime; 28 | private Date updateTime; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/Config.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.io.Serializable; 8 | 9 | @ToString 10 | @Setter 11 | @Getter 12 | public class Config implements Serializable { 13 | private Integer id; 14 | private String ConfigNo; 15 | private String ConfigName; 16 | private String ConfigValue; 17 | private String Remark ; 18 | private String EditBy ; 19 | private String EditTime ; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/JdOder.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.*; 4 | 5 | import java.util.Date; 6 | /** 7 | * 京东订单表 8 | */ 9 | @Data 10 | public class JdOder{ 11 | private Integer id; 12 | private String positionId; 13 | private Double actualCosPrice; 14 | private Double actualFee; 15 | private Long commissionRate; 16 | private Double estimateCosPrice; 17 | private Double estimateFee; 18 | private Double finalRate; 19 | private Double price; 20 | private Long skuId; 21 | private String skuName; 22 | private Long orderId; 23 | private Long payMonth; 24 | private Long finishTime; 25 | private Long orderTime; 26 | private Integer validCode; 27 | private Date createTime; 28 | private Date updateTime; 29 | private Integer settle; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/Oder.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 拼多多订单表 9 | */ 10 | @Data 11 | public class Oder { 12 | 13 | private Long id; 14 | 15 | 16 | private String orderSn; 17 | 18 | 19 | private Integer goodsId; 20 | 21 | private String goodsName; 22 | 23 | 24 | private String goodsThumbnailUrl; 25 | 26 | 27 | private Integer goodsQuantity; 28 | 29 | private Integer goodsPrice; 30 | 31 | 32 | private Integer orderAmount; 33 | 34 | 35 | private String pId; 36 | 37 | 38 | private Long promotionRate; 39 | private Long promotionAmount; 40 | private Integer orderStatus; 41 | 42 | private String orderStatusDesc; 43 | 44 | private Long orderCreateTime; 45 | 46 | private Long orderPayTime; 47 | private Long orderGroupSuccessTime; 48 | 49 | private Long orderVerifyTime; 50 | 51 | 52 | private Long orderModifyAt; 53 | 54 | private Date updatetime; 55 | 56 | 57 | private Byte status; 58 | 59 | 60 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/ScoreBean.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Data; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * Created by snake on 2018/11/14. 12 | 积分表 13 | */ 14 | @Data 15 | public class ScoreBean extends BaseBean implements Serializable { 16 | private Long userId; 17 | private Long score; 18 | private Integer dataSrc; 19 | private Integer dataId; 20 | private String dataRemarks; 21 | private Integer scoreType; 22 | private String day; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/SysAdvice.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | /** 7 | * @author heguoliang 8 | * @Description: TODO(通知表) 9 | * @date 2018-12-22 18:05:59 10 | */ 11 | public class SysAdvice implements Serializable { 12 | 13 | // 14 | private Integer id; 15 | //标题 16 | private Integer title; 17 | //内容 18 | private Long content; 19 | //头像 20 | private String img; 21 | //来 22 | private Integer status; 23 | //创建时间 24 | private Date createtime; 25 | 26 | /** 27 | * 设置: 28 | */ 29 | public void setId(Integer id) { 30 | this.id = id; 31 | } 32 | /** 33 | * 获取: 34 | */ 35 | public Integer getId() { 36 | return id; 37 | } 38 | /** 39 | * 设置:标题 40 | */ 41 | public void setTitle(Integer title) { 42 | this.title = title; 43 | } 44 | /** 45 | * 获取:标题 46 | */ 47 | public Integer getTitle() { 48 | return title; 49 | } 50 | /** 51 | * 设置:内容 52 | */ 53 | public void setContent(Long content) { 54 | this.content = content; 55 | } 56 | /** 57 | * 获取:内容 58 | */ 59 | public Long getContent() { 60 | return content; 61 | } 62 | /** 63 | * 设置:头像 64 | */ 65 | public void setImg(String img) { 66 | this.img = img; 67 | } 68 | /** 69 | * 获取:头像 70 | */ 71 | public String getImg() { 72 | return img; 73 | } 74 | /** 75 | * 设置:来 76 | */ 77 | public void setStatus(Integer status) { 78 | this.status = status; 79 | } 80 | /** 81 | * 获取:来 82 | */ 83 | public Integer getStatus() { 84 | return status; 85 | } 86 | /** 87 | * 设置:创建时间 88 | */ 89 | public void setCreatetime(Date createtime) { 90 | this.createtime = createtime; 91 | } 92 | /** 93 | * 获取:创建时间 94 | */ 95 | public Date getCreatetime() { 96 | return createtime; 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/SysDaygoods.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Builder; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | 11 | /** 12 | * @author heguoliang 13 | * @Description: TODO(每日爆款) 14 | * @date 2019-01-04 20:47:50 15 | */ 16 | @Setter 17 | @ToString 18 | @Getter 19 | public class SysDaygoods implements Serializable { 20 | private Integer id; 21 | //标题 22 | private String titile; 23 | //内容 24 | private String content; 25 | //头像 26 | private String image; 27 | //删除状态 28 | private Integer status; 29 | //创建时间 30 | private Date createtime; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/SysJhAdviceDev.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by snake on 2019/1/8. 11 | */ 12 | @ToString 13 | @Setter 14 | @Getter 15 | public class SysJhAdviceDev { 16 | // 17 | private Integer id; 18 | //标题 19 | private String titile; 20 | //内容 21 | private String content; 22 | //头像 23 | private String image; 24 | //图片URL 25 | private String contentImage; 26 | //创建时间 27 | private Date createtime; 28 | //修改时间 29 | 30 | 31 | private Date updatetime; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/SysJhAdviceOder.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * @author heguoliang 12 | * @Description: TODO(订单通知表) 13 | * @date 2019-01-11 16:28:45 14 | */ 15 | @Setter 16 | @Getter 17 | @ToString 18 | public class SysJhAdviceOder implements Serializable { 19 | 20 | // 21 | private Integer id; 22 | //用户id 23 | private Integer userid; 24 | //订单编号 25 | private Long oderSn; 26 | //平台类型 27 | private Integer src; 28 | //平台名称 29 | private String src_Name; 30 | //订单标题 31 | private String name; 32 | //用户名 33 | private String userName; 34 | //推广位 35 | private String pid; 36 | //订单状态 37 | private Integer order_Status; 38 | //订单状态描述 39 | private String order_Status_Desc; 40 | //订单的创建时间 41 | private Date oder_Createtime; 42 | //创建时间 43 | private Date createtime; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/SysJhImage.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by snake on 2019/1/12. 11 | */ 12 | @Setter 13 | @Getter 14 | @ToString 15 | public class SysJhImage { 16 | private Integer id; 17 | private Integer day; 18 | private String image; 19 | private Integer status; 20 | private Date createTime; 21 | private Date updateTime; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/SysJhJdHot.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.io.Serializable; 8 | import java.math.BigDecimal; 9 | import java.util.Date; 10 | 11 | /** 12 | * @author heguoliang 13 | * @Description: TODO(淘宝采集表) 14 | * @date 2019-02-26 15:57:13 15 | */ 16 | @Setter 17 | @Getter 18 | @ToString 19 | public class SysJhJdHot implements Serializable { 20 | 21 | // 22 | private Integer id; 23 | //商品图片 24 | private String picturl; 25 | //店铺名 26 | private String shoptitle; 27 | //标题 28 | private String title; 29 | //佣金比例 30 | private Double commissionrate; 31 | //优惠卷金额 32 | private Integer coupon; 33 | //推客的预估佣金额 34 | private BigDecimal zkfinalprice; 35 | //销量 36 | private Integer volume; 37 | //商品id 38 | private Long numiid; 39 | //删除状态 40 | private Integer status; 41 | //优惠卷权重 42 | private Integer orderCoupon; 43 | //优惠卷权重 44 | private Integer istamll; 45 | 46 | 47 | //佣金权重 48 | private Integer orderCommiss; 49 | 50 | //佣金权重 51 | private Double comssion; 52 | //销量权重 53 | private Integer orderVolume; 54 | //创建时间 55 | private Date createtime; 56 | 57 | private String jdurl; 58 | 59 | private String link; 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/TokenModel.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | /** 4 | * @Auther: le 5 | * @Date: 2018/8/17 15:39 6 | * @Description: 7 | */ 8 | //Token的Model类,可以增加字段提高安全性,例如时间戳、url签名 9 | public class TokenModel { 10 | private String userId; 11 | 12 | private String token; 13 | 14 | public TokenModel(String userId, String token){ 15 | this.userId = userId; 16 | this.token = token; 17 | } 18 | 19 | public String getUserId() { 20 | return userId; 21 | } 22 | 23 | public void setUserId(String userId) { 24 | this.userId = userId; 25 | } 26 | 27 | public String getToken() { 28 | return token; 29 | } 30 | 31 | public void setToken(String token) { 32 | this.token = token; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/User.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.superman.superman.model.enums.UserLevel; 7 | 8 | @TableName 9 | public class User extends BaseBean { 10 | @TableId(type = IdType.ASSIGN_ID) 11 | private Long userId; 12 | private String name; 13 | private String avatarUrl; 14 | private String mobile; 15 | private String password; 16 | private UserLevel userlevel; 17 | private Long superUser; 18 | private Long inviterUser; 19 | private String userTree; 20 | private Integer treeLevel; 21 | private String inviterCode; 22 | 23 | public String getInviterCode() { 24 | return inviterCode; 25 | } 26 | 27 | public User setInviterCode(String inviterCode) { 28 | this.inviterCode = inviterCode; 29 | return this; 30 | } 31 | 32 | public Long getSuperUser() { 33 | return superUser; 34 | } 35 | 36 | public User setSuperUser(Long superUser) { 37 | this.superUser = superUser; 38 | return this; 39 | } 40 | 41 | public Long getInviterUser() { 42 | return inviterUser; 43 | } 44 | 45 | public User setInviterUser(Long inviterUser) { 46 | this.inviterUser = inviterUser; 47 | return this; 48 | } 49 | 50 | public String getUserTree() { 51 | return userTree; 52 | } 53 | 54 | public User setUserTree(String userTree) { 55 | this.userTree = userTree; 56 | return this; 57 | } 58 | 59 | public Integer getTreeLevel() { 60 | return treeLevel; 61 | } 62 | 63 | public User setTreeLevel(Integer treeLevel) { 64 | this.treeLevel = treeLevel; 65 | return this; 66 | } 67 | 68 | public UserLevel getUserlevel() { 69 | return userlevel; 70 | } 71 | 72 | public User setUserlevel(UserLevel userlevel) { 73 | this.userlevel = userlevel; 74 | return this; 75 | } 76 | 77 | public Long getUserId() { 78 | return userId; 79 | } 80 | 81 | public User setUserId(Long userId) { 82 | this.userId = userId; 83 | return this; 84 | } 85 | 86 | public String getName() { 87 | return name; 88 | } 89 | 90 | public User setName(String name) { 91 | this.name = name; 92 | return this; 93 | } 94 | 95 | public String getAvatarUrl() { 96 | return avatarUrl; 97 | } 98 | 99 | public User setAvatarUrl(String avatarUrl) { 100 | this.avatarUrl = avatarUrl; 101 | return this; 102 | } 103 | 104 | public String getMobile() { 105 | return mobile; 106 | } 107 | 108 | public User setMobile(String mobile) { 109 | this.mobile = mobile; 110 | return this; 111 | } 112 | 113 | public String getPassword() { 114 | return password; 115 | } 116 | 117 | public User setPassword(String password) { 118 | this.password = password; 119 | return this; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/UserLog.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.superman.superman.model.enums.LogOperationEnum; 6 | 7 | import java.time.Instant; 8 | 9 | /** 10 | * Created by sanke on 2018/11/24. 11 | */ 12 | @TableName 13 | public class UserLog { 14 | @TableId 15 | private Long id; 16 | private Long userId; 17 | private LogOperationEnum operationEnum; 18 | private String ip; 19 | public Instant createTime=Instant.now(); 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public UserLog setId(Long id) { 26 | this.id = id; 27 | return this; 28 | } 29 | 30 | public Long getUserId() { 31 | return userId; 32 | } 33 | 34 | public UserLog setUserId(Long userId) { 35 | this.userId = userId; 36 | return this; 37 | } 38 | 39 | public LogOperationEnum getOperationEnum() { 40 | return operationEnum; 41 | } 42 | 43 | public UserLog setOperationEnum(LogOperationEnum operationEnum) { 44 | this.operationEnum = operationEnum; 45 | return this; 46 | } 47 | 48 | public String getIp() { 49 | return ip; 50 | } 51 | 52 | public UserLog setIp(String ip) { 53 | this.ip = ip; 54 | return this; 55 | } 56 | 57 | public Instant getCreateTime() { 58 | return createTime; 59 | } 60 | 61 | public UserLog setCreateTime(Instant createTime) { 62 | this.createTime = createTime; 63 | return this; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/enums/LogOperationEnum.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model.enums; 2 | 3 | public enum LogOperationEnum { 4 | /** 5 | * 用户登录 6 | */ 7 | USER_LOGIN 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/enums/Mall.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model.enums; 2 | 3 | public enum Mall { 4 | TMALL, 5 | TAOBAO, 6 | PDD, 7 | JD 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/enums/Platform.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model.enums; 2 | 3 | public enum Platform { 4 | PDD("拼多多"), 5 | JD("京东"), 6 | TAOBAO("淘宝"); 7 | 8 | private final String desc; 9 | 10 | Platform(String desc) { 11 | 12 | this.desc = desc; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/enums/UserLevel.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | 5 | public enum UserLevel { 6 | 7 | LOW(0, "普通用户"); 8 | 9 | UserLevel(int code, String descp) { 10 | this.code = code; 11 | this.descp = descp; 12 | } 13 | 14 | @EnumValue 15 | private final int code; 16 | 17 | private final String descp; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/model/enums/uso.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.model.enums; 2 | 3 | import org.springframework.data.annotation.Id; 4 | 5 | public class uso { 6 | @Id 7 | private Long id; 8 | 9 | private String username; 10 | 11 | private String password; 12 | 13 | public Long getId() { 14 | return id; 15 | } 16 | 17 | public void setId(Long id) { 18 | this.id = id; 19 | } 20 | 21 | public String getUsername() { 22 | return username; 23 | } 24 | 25 | public void setUsername(String username) { 26 | this.username = username; 27 | } 28 | 29 | public String getPassword() { 30 | return password; 31 | } 32 | 33 | public void setPassword(String password) { 34 | this.password = password; 35 | } 36 | 37 | public uso(Long id, String username, String password) { 38 | this.id = id; 39 | this.username = username; 40 | this.password = password; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/AbstractCommonService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform; 2 | 3 | import com.superman.superman.dto.GoodsDetailReq; 4 | import com.superman.superman.dto.GoodsDetailResponse; 5 | import com.superman.superman.model.User; 6 | import com.superman.superman.service.OderService; 7 | import com.superman.superman.service.ScoreService; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.beans.factory.ObjectProvider; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.core.env.Environment; 13 | import org.springframework.web.client.RestTemplate; 14 | 15 | import javax.servlet.http.HttpServletRequest; 16 | import javax.servlet.http.HttpServletResponse; 17 | 18 | /** 19 | * Created by snake on 2019-10-16. 20 | * 基础功能 21 | */ 22 | abstract class AbstractCommonService implements CommonService { 23 | protected final Logger logger = LoggerFactory.getLogger(getClass()); 24 | @Autowired 25 | private ObjectProvider oderServiceObjectProvider; 26 | @Autowired 27 | private ObjectProvider scoreServiceObjectProvider; 28 | @Autowired 29 | private ObjectProvider restTemplate; 30 | @Autowired 31 | private Environment environment; 32 | 33 | @Override 34 | public void convertUrl(HttpServletRequest request, HttpServletResponse response) { 35 | 36 | } 37 | 38 | /** 39 | * 获取订单服务 40 | * 41 | * @return 42 | */ 43 | protected final OderService getOderService() { 44 | return oderServiceObjectProvider.getIfAvailable(); 45 | } 46 | 47 | /** 48 | * 获取积分服务 49 | * 50 | * @return 51 | */ 52 | @Override 53 | public String authLogin(User user) { 54 | return "该平台暂时不支持授权操作"; 55 | } 56 | 57 | /** 58 | * 获取积分服务 59 | * 60 | * @return 61 | */ 62 | protected final ScoreService getScoreService() { 63 | return scoreServiceObjectProvider.getIfAvailable(); 64 | } 65 | 66 | /** 67 | * 网络服务 68 | * 69 | * @return 70 | */ 71 | protected final RestTemplate getRestTemplate() { 72 | return restTemplate.getIfAvailable(); 73 | } 74 | 75 | 76 | /** 77 | * 获取积分服务 78 | * 79 | * @return 80 | */ 81 | @Override 82 | public GoodsDetailResponse goodDetail(GoodsDetailReq req) { 83 | return null; 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/CommonService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform; 2 | 3 | import com.superman.superman.dto.GoodsDetailReq; 4 | import com.superman.superman.dto.GoodsDetailResponse; 5 | import com.superman.superman.dto.GoodsSearchReq; 6 | import com.superman.superman.dto.GoodsSearchResponse; 7 | import com.superman.superman.model.User; 8 | import com.superman.superman.model.enums.Platform; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | /** 14 | * 公用服务抽象 15 | */ 16 | public interface CommonService { 17 | /** 18 | * 商品搜索服务 19 | * @param GoodsSearchReq 20 | * @return 21 | */ 22 | GoodsSearchResponse searchGoods(GoodsSearchReq GoodsSearchReq); 23 | /** 24 | * 商品搜索服务 25 | * @param GoodsSearchReq 26 | * @return 27 | */ 28 | GoodsDetailResponse goodDetail(GoodsDetailReq GoodsSearchReq); 29 | /** 30 | * 执行授权操作 31 | * @return 32 | */ 33 | String authLogin(User user); 34 | /** 35 | * 转链操作 36 | * @return 37 | */ 38 | void convertUrl(HttpServletRequest request, HttpServletResponse response); 39 | 40 | 41 | Platform getPlatform(); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/JdBasePlatformService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform; 2 | 3 | import com.superman.superman.dto.GoodsSearchReq; 4 | import com.superman.superman.dto.GoodsSearchResponse; 5 | import com.superman.superman.model.User; 6 | import com.superman.superman.model.enums.Platform; 7 | import com.superman.superman.platform.dto.PddGoodSearchRequest; 8 | import com.superman.superman.platform.dto.baseGoodSearchRequest; 9 | import com.superman.superman.platform.dto.BaseGoodSearchResponse; 10 | import org.springframework.stereotype.Service; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | /** 16 | * 京东官方的API接口服务 17 | * Created by GGsnake on 2018/11/14. 18 | */ 19 | @Service 20 | class JdBasePlatformService extends AbstractCommonService { 21 | 22 | 23 | @Override 24 | public GoodsSearchResponse searchGoods(GoodsSearchReq req) { 25 | return null; 26 | } 27 | 28 | 29 | @Override 30 | public void convertUrl(HttpServletRequest request, HttpServletResponse response) { 31 | 32 | } 33 | 34 | @Override 35 | public Platform getPlatform() { 36 | return Platform.JD; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/PddBasePlatformService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform; 2 | 3 | import com.pdd.pop.sdk.http.PopHttpClient; 4 | import com.pdd.pop.sdk.http.api.pop.request.PddDdkGoodsSearchRequest; 5 | import com.pdd.pop.sdk.http.api.pop.response.PddDdkGoodsSearchResponse; 6 | import com.superman.superman.dto.GoodsSearchReq; 7 | import com.superman.superman.dto.GoodsSearchResponse; 8 | import com.superman.superman.model.enums.Platform; 9 | import org.springframework.stereotype.Service; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import java.math.BigDecimal; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | /** 18 | * 拼多多官方的API接口服务 19 | * Created by snake on 2018/11/14. 20 | */ 21 | @Service 22 | class PddBasePlatformService extends AbstractCommonService { 23 | String KEY = "48dcc8985c8e4838be2dea3aa9b6176f"; 24 | String SECRET = "62b91c07f697bce84beec4123b01f6e108d2fa38"; 25 | private final PopHttpClient client; 26 | 27 | public PddBasePlatformService() { 28 | client = new PopHttpClient(KEY, SECRET); 29 | } 30 | 31 | 32 | @Override 33 | public GoodsSearchResponse searchGoods(GoodsSearchReq req) { 34 | GoodsSearchResponse response = new GoodsSearchResponse(); 35 | List goodsSearchResponseArrayList = new ArrayList<>(); 36 | PddDdkGoodsSearchRequest request = new PddDdkGoodsSearchRequest(); 37 | request.setKeyword(req.getKeyword()); 38 | request.setOptId(req.getOpt()); 39 | request.setPage(req.getPageNo() == null ? 1 : req.getPageNo()); 40 | request.setPageSize(req.getPageSize() == null ? 10 : req.getPageSize()); 41 | // request.setWithCoupon(req.getHasCoupon() == null ? false : true); 42 | try { 43 | PddDdkGoodsSearchResponse pddDdkGoodsSearchResponse = client.syncInvoke(request); 44 | PddDdkGoodsSearchResponse.GoodsSearchResponse goodsSearchResponse = pddDdkGoodsSearchResponse.getGoodsSearchResponse(); 45 | response.setGoodsDetailList(goodsSearchResponseArrayList); 46 | if (goodsSearchResponse == null|| goodsSearchResponse.getTotalCount()==0) return response; 47 | response.setTotalCount(goodsSearchResponse.getTotalCount()); 48 | goodsSearchResponse.getGoodsList().forEach(detail -> { 49 | BigDecimal divide = new BigDecimal(detail.getMinNormalPrice()).movePointLeft(2); 50 | goodsSearchResponseArrayList 51 | .add(new GoodsSearchResponse.GoodDetail() 52 | .setPrice(divide) 53 | .setGoodName(detail.getGoodsName()) 54 | .setHasCoupon(detail.getHasCoupon() ? 1 : 0) 55 | ); 56 | }); 57 | return response.setGoodsDetailList(goodsSearchResponseArrayList); 58 | } catch (Exception e) { 59 | logger.error("请求拼多多接口失败 请重试{}", e.getMessage()); 60 | } 61 | return null; 62 | } 63 | 64 | @Override 65 | public Platform getPlatform() { 66 | return Platform.PDD; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/TaobaoBasePlatformService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform; 2 | 3 | import com.superman.superman.dto.GoodsSearchReq; 4 | import com.superman.superman.dto.GoodsSearchResponse; 5 | import com.superman.superman.model.enums.Platform; 6 | import org.springframework.stereotype.Service; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | /** 12 | * 淘宝官方的API接口服务 13 | * Created by GGsnake on 2018/11/14. 14 | */ 15 | @Service 16 | class TaobaoBasePlatformService extends AbstractCommonService { 17 | 18 | @Override 19 | public GoodsSearchResponse searchGoods(GoodsSearchReq baseGoodSearchRequest) { 20 | return null; 21 | } 22 | 23 | 24 | @Override 25 | public void convertUrl(HttpServletRequest request, HttpServletResponse response) { 26 | 27 | } 28 | 29 | @Override 30 | public Platform getPlatform() { 31 | return Platform.TAOBAO; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/dto/BaseGoodSearchResponse.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform.dto; 2 | 3 | public abstract class BaseGoodSearchResponse { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/dto/PddGoodSearchRequest.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform.dto; 2 | 3 | public class PddGoodSearchRequest extends baseGoodSearchRequest{ 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/platform/dto/baseGoodSearchRequest.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.platform.dto; 2 | 3 | public abstract class baseGoodSearchRequest { 4 | private String goodName; 5 | private String pageSize; 6 | private String pageNo; 7 | 8 | public String getGoodName() { 9 | return goodName; 10 | } 11 | 12 | public baseGoodSearchRequest setGoodName(String goodName) { 13 | this.goodName = goodName; 14 | return this; 15 | } 16 | 17 | public String getPageSize() { 18 | return pageSize; 19 | } 20 | 21 | public baseGoodSearchRequest setPageSize(String pageSize) { 22 | this.pageSize = pageSize; 23 | return this; 24 | } 25 | 26 | public String getPageNo() { 27 | return pageNo; 28 | } 29 | 30 | public baseGoodSearchRequest setPageNo(String pageNo) { 31 | this.pageNo = pageNo; 32 | return this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/req/AuthenticationInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.req; 2 | 3 | import com.superman.superman.annotation.LoginRequired; 4 | import com.superman.superman.model.TokenModel; 5 | import com.superman.superman.service.TokenService; 6 | import com.superman.superman.utils.Constants; 7 | import lombok.extern.java.Log; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.method.HandlerMethod; 10 | import org.springframework.web.servlet.HandlerInterceptor; 11 | import org.springframework.web.servlet.ModelAndView; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.lang.reflect.Method; 16 | 17 | /** 18 | * Created by snake on 2018/11/21. 19 | */ 20 | @Log 21 | public class AuthenticationInterceptor implements HandlerInterceptor { 22 | @Autowired 23 | private TokenService manager; 24 | 25 | @Override 26 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 27 | if (!(handler instanceof HandlerMethod)) { 28 | response.sendError(401, "请登录"); 29 | return true; 30 | } 31 | HandlerMethod handlerMethod = (HandlerMethod) handler; 32 | Method method = handlerMethod.getMethod(); 33 | LoginRequired methdAnno = method.getAnnotation(LoginRequired.class); 34 | if (methdAnno == null) { 35 | return true; 36 | } 37 | //从header中得到token 38 | String authorization = request.getHeader(Constants.AUTHORIZATION); 39 | //验证token 40 | TokenModel model = manager.getToken(authorization); 41 | if (manager.checkToken(model)) { 42 | //如果token验证成功,将token对应的用户id存在request中,便于之后注入 43 | request.setAttribute(Constants.CURRENT_USER_ID, model.getUserId()); 44 | return true; 45 | } 46 | //如果验证token失败,并且方法注明了Authorization,返回401错误 47 | if (method.getAnnotation(LoginRequired.class) != null) { 48 | response.sendError(401, "token失效,请重新登录"); 49 | response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); 50 | return false; 51 | } 52 | return true; 53 | } 54 | 55 | @Override 56 | public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { 57 | 58 | } 59 | 60 | @Override 61 | public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/req/BindWxToUser.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.req; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | /** 8 | * Created by snake on 2018/12/20. 9 | */ 10 | @Setter 11 | @Getter 12 | @ToString 13 | public class BindWxToUser { 14 | private String wx; 15 | private String nickname; 16 | private String headimgurl; 17 | private String token; 18 | private String phone; 19 | 20 | public Boolean isNone(){ 21 | if (this.wx==null||this.nickname==null||this.headimgurl==null||this.token==null){ 22 | return true; 23 | } 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/req/Collect.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.req; 2 | 3 | import lombok.Data; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | import java.util.Date; 9 | 10 | /** 11 | * Created by snake on 2018/12/15. 12 | */ 13 | @Data 14 | public class Collect { 15 | //销量 16 | private Integer volume; 17 | private String image; 18 | private Long promotion_rate; 19 | private Long coupon; 20 | private Integer src; 21 | private Double price; 22 | private Double coupon_price; 23 | private Long goodId; 24 | private String title; 25 | public Boolean param(){ 26 | if (image==null||src==null||price==null||goodId==null||title==null){ 27 | return false; 28 | } 29 | return true; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/req/OderPdd.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.req; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | /** 8 | * Created by snake on 2018/12/19. 9 | */ 10 | @Setter 11 | @Getter 12 | @ToString 13 | public class OderPdd { 14 | private Long goods_id; 15 | private Long promotion_amount; 16 | private String goods_name; 17 | private Long order_create_time; 18 | private String goods_thumbnail_url; 19 | private String order_sn; 20 | private String p_id; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/req/OptReq.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.req; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | @ToString 8 | @Setter 9 | @Getter 10 | public class OptReq { 11 | private String keyword; 12 | private String cat; 13 | private String field; 14 | private String sort; 15 | private String startprice; 16 | private String endprice; 17 | private String itemid; 18 | private String itemtype; 19 | private String start_time; 20 | private String page; 21 | private String pagesize; 22 | private String end_time; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/req/UpdateWxOpenId.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.req; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | /** 8 | * Created by snake on 2019/1/9. 9 | */ 10 | @ToString 11 | @Setter 12 | @Getter 13 | public class UpdateWxOpenId { 14 | private String id; 15 | private String name; 16 | private String photo; 17 | private String phone; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/AdviceService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.superman.superman.model.SysAdvice; 4 | import com.superman.superman.model.SysJhAdviceOder; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * @author heguoliang 12 | * @Description: TODO(通知表) 13 | * @date 2018-12-22 18:05:59 14 | */ 15 | public interface AdviceService { 16 | /** 17 | * 批量查询官方通知 18 | * @param map 19 | * @return 20 | */ 21 | List queryList(Map map); 22 | 23 | /** 24 | * 统计官方通知数量 25 | * @param map 26 | * @return 27 | */ 28 | int queryTotal(Map map); 29 | 30 | 31 | /** 32 | * 查询用户订单通知(分页) 33 | * @param uid 34 | * @return 35 | */ 36 | List queryListOderAdvice(Long uid,PageParam pageParam); 37 | /** 38 | * 统计用户订单通知数量 39 | * @param uid 40 | * @return 41 | */ 42 | Integer countListOderAdvice(Long uid); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/CollectService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.superman.superman.model.CollectBean; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | /** 8 | * Created by snake on 2018/11/20. 9 | */ 10 | public interface CollectService { 11 | /** 12 | * 13 | * @param uid 14 | * @return 15 | */ 16 | JSONArray queryCollect(Long uid, PageParam pageParam); 17 | 18 | /** 19 | * 20 | * @param colId 21 | * @return 22 | */ 23 | Boolean deleteCollect(Integer colId,Long uid); 24 | /** 25 | * 26 | * @param uid 27 | * @return 28 | */ 29 | Integer countCollect(Long uid); 30 | 31 | /** 32 | * 33 | * @param collectBean 34 | * @return 35 | */ 36 | Boolean addCollect(CollectBean collectBean); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/FriendDtoService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | public interface FriendDtoService { 8 | JSONObject queryList(PageParam pageParam); 9 | JSONArray queryListFriend(PageParam pageParam); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/GoodsService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.superman.superman.model.User; 4 | import com.superman.superman.model.enums.Platform; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by snake on 2018/11/14. 11 | */ 12 | public interface GoodsService { 13 | /** 14 | * 查询商品 15 | * 16 | * @param pageParam 17 | * @return 18 | */ 19 | Object searchGoods(Platform platform, PageParam pageParam); 20 | 21 | /** 22 | * 授权登录地址 23 | * @param platform 24 | * @param user 25 | * @return 26 | */ 27 | String authLogin(Platform platform, User user); 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/JdApiService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.utils.PageParam; 5 | 6 | /** 7 | * Created by snake on 2018/11/14. 8 | */ 9 | public interface JdApiService { 10 | // /** 11 | // * 京东生成推广URL 12 | // * @param pid 13 | // * @param materialId 14 | // * @return 15 | // */ 16 | // JSONObject convertJd(String pid, String materialId,String coupon); 17 | // 18 | // 19 | // /** 20 | // * 京东搜索引擎 21 | // * @param goodsReq 22 | // * @param uid 23 | // * @return 24 | // */ 25 | // JSONObject serachGoodsAllJd(GoodsReq goodsReq, Long uid); 26 | // /** 27 | // * 京东搜索引擎 28 | // * @param 29 | // * @param uid 30 | // * @return 31 | // */ 32 | // JSONObject goodLocal(PageParam pageParam, Long uid, Integer status); 33 | // /** 34 | // * 京东搜索引擎 35 | // * @param 36 | // * @param uid 37 | // * @return 38 | // */ 39 | // JSONObject goodLocal(PageParam pageParam, Long uid, Integer status,Integer cid); 40 | // 41 | // /** 京东商品详情 42 | // * 商品ID 43 | // * @param goodId 44 | // * @return 45 | // */ 46 | // JSONObject jdDetail(Long goodId); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/LogService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.superman.superman.model.UserLog; 4 | import org.apache.ibatis.annotations.Insert; 5 | 6 | /** 7 | * Created by snake on 2018/11/24. 8 | */ 9 | public interface LogService { 10 | /** 11 | * 登录日志写入 12 | * @param uid 13 | * @param ip 14 | */ 15 | void addUserLoginLog(Long uid,String ip); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/MemberService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.model.Userinfo; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | /** 8 | * Created by snake on 2018/11/8. 9 | */ 10 | public interface MemberService { 11 | /** 12 | * 获取预估收入 13 | * @param uid 14 | * @return 15 | */ 16 | JSONObject getMyMoney(Long uid); 17 | 18 | /** 19 | * 获取我的团队直属会员和直属代理 20 | * 21 | * @param userId 22 | * @param pageParam 分页参数 23 | * @return 24 | */ 25 | JSONObject getMyTeam(Long userId, PageParam pageParam); 26 | 27 | /** 28 | * 代理的会员下级(总代专属) 29 | * @param userId 30 | * @param pageParam 31 | * @return 32 | */ 33 | JSONObject getMyNoFans(Long userId, PageParam pageParam); 34 | 35 | /**查询代理的业绩情况(总代理专属) 36 | * @param userId 37 | * @param myId 38 | * @return 39 | */ 40 | JSONObject queryMemberDetail(Long userId, Integer myId); 41 | 42 | /**查询自己的的业绩情况 43 | * @param userId 44 | * @return 45 | */ 46 | JSONObject queryMemberDetail(Long userId); 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/MoneyService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.model.Userinfo; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * Created by snake on 2018/12/13. 10 | */ 11 | public interface MoneyService { 12 | /** 13 | * 获取已结算待结算 14 | * 15 | * @param status 0未结算 1已结算 16 | * @return 17 | */ 18 | Long queryCashMoney(Integer status, Userinfo user); 19 | /** 20 | * 获取预估收入 21 | * 22 | * @param user 23 | * @return 24 | */ 25 | Long queryCashMoney(Userinfo user); 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/OderService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.model.Oder; 5 | import com.superman.superman.model.Userinfo; 6 | import com.superman.superman.utils.PageParam; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by snake on 2018/11/14. 12 | */ 13 | public interface OderService { 14 | /** 15 | * 分页查询拼多多的订单 16 | * 17 | * @param userinfo 18 | * @param status 19 | * @param pageParam 20 | * @return 21 | */ 22 | JSONObject queryPddOder(Userinfo userinfo, List status, PageParam pageParam); 23 | 24 | /** 25 | * 分页查询京东的订单 26 | * 27 | * @param userinfo 28 | * @param status 29 | * @param pageParam 30 | * @return 31 | */ 32 | JSONObject queryJdOder(Userinfo userinfo, List status, PageParam pageParam); 33 | 34 | /** 35 | * 分页查询淘宝的订单 36 | * 37 | * @param userinfo 38 | * @param status 39 | * @param pageParam 40 | * @return 41 | */ 42 | JSONObject queryTbOder(Userinfo userinfo, List status, PageParam pageParam); 43 | 44 | /** 45 | * 统计已结算/未结算 订单 46 | * 47 | * @param uidList 48 | * @param status 0 代表未结算 1 已结算 49 | * @return 50 | */ 51 | Long superQueryOderForUidList(List uidList, Integer status); 52 | 53 | /** 54 | * 统计我的预估收入(未结算和已经结算混合一起) 55 | * 56 | * @param uidList 57 | * @return 58 | */ 59 | Long superQueryOderForUidListToEstimate(List uidList); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/OtherService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.superman.superman.model.Config; 6 | import com.superman.superman.model.Userinfo; 7 | import com.superman.superman.utils.PageParam; 8 | 9 | import java.io.ByteArrayOutputStream; 10 | import java.io.IOException; 11 | 12 | /** 13 | * Created by snake on 2018/11/20. 14 | */ 15 | public interface OtherService { 16 | /** 17 | * 创建二维码图片返回 ByteArrayOutputStream流 18 | * @param content 19 | * @return 20 | */ 21 | ByteArrayOutputStream crateQRCode(String content); 22 | /** 23 | * 查询官方通知 24 | * @param pageParam 25 | * @return 26 | */ 27 | JSONArray queryAdviceForDev(PageParam pageParam); 28 | 29 | /** 30 | * 根据URL地址生成二维码图片 31 | * @param data url地址 32 | * @param uid 33 | * @return 34 | */ 35 | String addQrCodeUrl(String data, String uid); 36 | 37 | /** 38 | * 生成分享APP邀请二维码的图片URL 39 | * 40 | * @param data 41 | * @param uid 42 | * @return 43 | * @throws IOException 44 | */ 45 | String addQrCodeUrlInv(String data, String uid); 46 | 47 | /** 48 | * 微信预付款 49 | * 50 | * @param uid 51 | * @param ip 52 | * @return 53 | */ 54 | JSONObject payMoney(String uid, String ip); 55 | /** 56 | * 更新朋友圈的商品 57 | * 58 | * @return 59 | */ 60 | void updateFrientGoods(); 61 | 62 | /** 63 | * 生成邀请二维码 64 | * 65 | * @param userinfo 66 | * @return 67 | */ 68 | String builderInviteCodeUrl(Userinfo userinfo); 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/PddApiService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.pdd.pop.sdk.http.api.request.PddDdkGoodsSearchRequest; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | /** 8 | * Created by snake on 2018/11/6. 9 | */ 10 | public interface PddApiService { 11 | /** 12 | *生成推广链接 13 | * @param goodId 需要推广的商品id列表 14 | * @param pid 推广位ID 15 | * @return 16 | */ 17 | JSONObject convertPdd(String pid, Long goodId); 18 | 19 | /** 拼多多商品详情 20 | * 商品ID 21 | * @param goodIdList 22 | * @return 23 | */ 24 | JSONObject pddDetail(Long goodIdList); 25 | 26 | /** 27 | * 拼多多搜索引擎 28 | * @param request 29 | * @param uid 30 | * @return 31 | */ 32 | JSONObject serachGoodsAll(PddDdkGoodsSearchRequest request, Long uid); 33 | /** 34 | * 拼多多本地搜索引擎 35 | * @param pageParam 36 | * @param uid 37 | * @return 38 | */ 39 | JSONObject getLocalGoodsAll(PageParam pageParam, Long uid); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/ScoreService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.model.ScoreBean; 5 | 6 | /** 7 | * Created by snake on 2018/11/14. 8 | */ 9 | public interface ScoreService { 10 | /** 11 | * 查询当天积分 12 | * @param scoreBean 13 | * @return 14 | */ 15 | Boolean isExitSign(ScoreBean scoreBean); 16 | /** 17 | * 查询当天积分 18 | * @param 19 | * @return 20 | */ 21 | JSONObject myScore(Integer uid); 22 | 23 | /** 24 | * 查询浏览商品次数 25 | * @param uid 26 | * @return 27 | */ 28 | Long countLooks(Long uid); 29 | 30 | /** 31 | *查询浏览分享次数 32 | * @param uid 33 | * @return 34 | */ 35 | Boolean isShare(Long uid); 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/SysDaygoodsService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.model.SysDaygoods; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | /** 8 | * @author heguoliang 9 | * @Description: TODO(每日爆款) 10 | * @date 2019-01-04 20:47:50 11 | */ 12 | public interface SysDaygoodsService { 13 | /** 14 | * 查询每日爆款 15 | * @param pageParam 16 | * @return 17 | */ 18 | JSONObject queryList(PageParam pageParam); 19 | /** 20 | * 更新 21 | * @param daygoods 22 | */ 23 | void update(SysDaygoods daygoods); 24 | /** 25 | * 删除 26 | * @param id 27 | */ 28 | void delete(Integer id); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/TaoBaoApiService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.superman.superman.req.OptReq; 5 | import com.superman.superman.utils.PageParam; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * Created by snake on 2018/12/4. 12 | */ 13 | public interface TaoBaoApiService { 14 | /** 15 | * 淘宝搜索引擎 16 | * 17 | * @param request 18 | * @param uid 19 | * @return 20 | */ 21 | // JSONObject serachGoodsAll(TbkDgMaterialOptionalRequest request, Long uid); 22 | 23 | /** 24 | * 本地淘宝搜索引擎加强版 25 | * 26 | * @return 27 | */ 28 | JSONObject goodLocalSuperForOpt(JSONObject pageParam,Long uid, Integer status); 29 | 30 | 31 | /** 32 | * 查询淘宝商品单个的缩略图 33 | * 34 | * @param goodId 35 | * @return 36 | */ 37 | String deatilGoodList(Long goodId); 38 | 39 | /** 40 | * 生成淘口令推广链接 41 | * 42 | * @param rid 43 | * @param good_id 44 | * @return 45 | */ 46 | JSONObject convertTaobao(String rid, Long good_id); 47 | 48 | 49 | /** 50 | * 解析淘口令 51 | * 52 | * @param tkl 53 | * @return 54 | */ 55 | JSONObject convertTaobaoTkl(String tkl); 56 | 57 | 58 | /** 59 | * 查询淘宝的商品详情 60 | * 61 | * @return 62 | */ 63 | JSONObject deatil(Long goodId); 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/TokenService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.superman.superman.model.TokenModel; 4 | 5 | /** 6 | * @Auther: le 7 | * @Date: 2018/8/17 17:09 8 | * @Description: 9 | */ 10 | public interface TokenService { 11 | 12 | /** 13 | * 创建一个token关联上指定用户 14 | * @param userId 指定用户的id 15 | * @return 生成的token 16 | */ 17 | public TokenModel createToken(String userId); 18 | 19 | /** 20 | * 检查token是否有效 21 | * @param model token 22 | * @return 是否有效 23 | */ 24 | 25 | public boolean checkToken(TokenModel model); 26 | 27 | /** 28 | * 从字符串中解析token 29 | * @param authentication 加密后的字符串 30 | * @return 31 | */ 32 | public TokenModel getToken(String authentication); 33 | 34 | /** 35 | * 清除token 36 | * @param userId 登录用户的id 37 | */ 38 | public void deleteToken(String userId); 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.superman.superman.dto.UserCreateReq; 5 | import com.superman.superman.model.User; 6 | import com.superman.superman.model.Userinfo; 7 | 8 | import java.util.Map; 9 | import java.util.Optional; 10 | 11 | /** 12 | * Created by snake on 2018/11/6. 13 | */ 14 | public interface UserService extends IService { 15 | /** 16 | * 创建用户 17 | * @param req 18 | * @return 19 | */ 20 | void createUser(UserCreateReq req); 21 | 22 | /**用户是否存在 23 | * @return 24 | */ 25 | Optional existUserByPhone(String phone); 26 | 27 | 28 | /**查找用户的直属上级 29 | * @return 30 | */ 31 | Optional findSuperUserByCode(String code); 32 | 33 | /** 34 | * 为用户分配平台推广位接口 35 | * @return 36 | */ 37 | Map createPid(); 38 | 39 | /** 40 | * 生成淘宝用户授权 41 | * 42 | * @return 43 | */ 44 | String taobaoOAuth(Userinfo userinfo); 45 | /** 46 | * 淘宝授权回调喵有券备案渠道 47 | * 48 | * @return 49 | */ 50 | String relationBak(Userinfo userinfo); 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/impl/AdviceServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service.impl; 2 | 3 | import com.superman.superman.dao.AgentDao; 4 | import com.superman.superman.dao.SysAdviceDao; 5 | import com.superman.superman.model.SysAdvice; 6 | import com.superman.superman.model.SysJhAdviceOder; 7 | import com.superman.superman.service.AdviceService; 8 | import com.superman.superman.utils.PageParam; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | @Service("adviceService") 17 | public class AdviceServiceImpl implements AdviceService { 18 | @Autowired 19 | private SysAdviceDao adviceDao; 20 | @Autowired 21 | private AgentDao agentDao; 22 | 23 | @Override 24 | public List queryList(Map map) { 25 | return adviceDao.queryList(map); 26 | } 27 | 28 | @Override 29 | public int queryTotal(Map map) { 30 | return adviceDao.queryTotal(map); 31 | } 32 | 33 | @Override 34 | public List queryListOderAdvice(Long uid, PageParam pageParam) { 35 | List var = new ArrayList(); 36 | var.add(uid); 37 | List ids = agentDao.queryForAgentIdNew(uid.intValue()); 38 | if (ids != null) { 39 | var.addAll(ids); 40 | } 41 | List sysJhAdviceOders = adviceDao.querySysOderAdvice(var, pageParam.getStartRow(), pageParam.getPageSize()); 42 | return sysJhAdviceOders; 43 | } 44 | 45 | @Override 46 | public Integer countListOderAdvice(Long uid) { 47 | List var = new ArrayList(); 48 | var.add(uid); 49 | List ids = agentDao.queryForAgentIdNew(uid.intValue()); 50 | if (ids != null) { 51 | var.addAll(ids); 52 | } 53 | Integer sum = adviceDao.countSysOderAdvice(var); 54 | return sum; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/impl/FriendDtoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service.impl; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.superman.superman.dao.SysJhTaobaoHotDao; 6 | import com.superman.superman.dto.SysDayGoodDto; 7 | import com.superman.superman.model.SysJhTaobaoAll; 8 | import com.superman.superman.utils.PageParam; 9 | import org.springframework.beans.BeanUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | import com.superman.superman.dto.SysFriendDto; 16 | import com.superman.superman.dao.SysFriendDtoMapper; 17 | import com.superman.superman.service.FriendDtoService; 18 | 19 | @Service 20 | public class FriendDtoServiceImpl implements FriendDtoService { 21 | @Autowired 22 | private SysFriendDtoMapper sysFriendDtoMapper; 23 | @Override 24 | public JSONObject queryList(PageParam pageParam) { 25 | PageParam temp = new PageParam(pageParam.getPageNo(), pageParam.getPageSize()); 26 | List sysFriendDtos = sysFriendDtoMapper.queryListGod(temp.getStartRow(), temp.getPageSize()); 27 | Integer count = sysFriendDtoMapper.count(); 28 | JSONObject var = new JSONObject(); 29 | JSONArray data = new JSONArray(); 30 | if (count == null || count == 0) { 31 | var.put("pageCount", 0); 32 | var.put("pageData", data); 33 | return var; 34 | } 35 | for (SysFriendDto var1 : sysFriendDtos) { 36 | SysDayGoodDto dto = new SysDayGoodDto(); 37 | BeanUtils.copyProperties(var1, dto); 38 | List images = sysFriendDtoMapper.getImages(var1.getId()); 39 | dto.setContent_Images(images); 40 | data.add(dto); 41 | } 42 | var.put("pageCount", count); 43 | var.put("pageData", data); 44 | return var; 45 | } 46 | 47 | @Autowired 48 | private SysJhTaobaoHotDao sysJhTaobaoHotDao; 49 | 50 | @Override 51 | public JSONArray queryListFriend(PageParam pageParam) { 52 | PageParam temp = new PageParam(pageParam.getPageNo(), pageParam.getPageSize()); 53 | 54 | JSONObject tempObject = null; 55 | JSONArray dataArray = new JSONArray(); 56 | 57 | List sysFriendDtos = sysFriendDtoMapper.queryListFriend(temp.getStartRow(), temp.getPageSize()); 58 | for (SysFriendDto var : sysFriendDtos) { 59 | tempObject = new JSONObject(); 60 | String goodIds = var.getGoodIds(); 61 | JSONObject text = JSONObject.parseObject(goodIds); 62 | tempObject.put("titile",var.getTitile()); 63 | tempObject.put("content",var.getContent()); 64 | tempObject.put("image",var.getImage()); 65 | tempObject.put("createtime",var.getCreatetime()); 66 | JSONArray data = text.getJSONArray("data"); 67 | JSONArray jsonArray = new JSONArray(); 68 | data.forEach(child -> { 69 | Long goodId = (Long)child; 70 | JSONObject tempMap=new JSONObject(); 71 | SysJhTaobaoAll sysJhTaobaoAll = sysJhTaobaoHotDao.queryLocalSimple(goodId); 72 | tempMap.put("goodId",sysJhTaobaoAll.getNumiid()); 73 | tempMap.put("imagUrl",sysJhTaobaoAll.getPicturl()); 74 | tempMap.put("isTmall",sysJhTaobaoAll.getIstamll()); 75 | tempMap.put("goodName",sysJhTaobaoAll.getTitle()); 76 | tempMap.put("coupon",sysJhTaobaoAll.getCoupon()); 77 | tempMap.put("volume",sysJhTaobaoAll.getVolume()); 78 | tempMap.put("zk_price",sysJhTaobaoAll.getCouponprice()); 79 | tempMap.put("price",sysJhTaobaoAll.getZkfinalprice()); 80 | jsonArray.add(tempMap); 81 | }); 82 | tempObject.put("dataArray",jsonArray); 83 | dataArray.add(tempObject); 84 | } 85 | return dataArray; 86 | 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/impl/GoodsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service.impl; 2 | 3 | import com.superman.superman.model.User; 4 | import com.superman.superman.model.Userinfo; 5 | import com.superman.superman.model.enums.Platform; 6 | import com.superman.superman.platform.CommonService; 7 | import com.superman.superman.service.GoodsService; 8 | import com.superman.superman.utils.PageParam; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.*; 12 | 13 | /** 14 | * Created by GGsnake on 2019/10/16. 15 | */ 16 | @Service("goodsService") 17 | public class GoodsServiceImpl implements GoodsService { 18 | 19 | private final Map commonServiceMap; 20 | 21 | 22 | public GoodsServiceImpl(Collection repaymentGateways) { 23 | this.commonServiceMap = repaymentGateways.stream() 24 | .collect(HashMap::new, (map, platform) -> map.put(platform.getPlatform(), platform), HashMap::putAll); 25 | } 26 | 27 | /** 28 | * 获取来源 29 | * 30 | * @return 31 | */ 32 | private CommonService getPlatform(Platform platform) { 33 | return Optional.ofNullable(commonServiceMap.get(platform)) 34 | .orElseThrow(() -> new IllegalArgumentException("不支持")); 35 | } 36 | 37 | @Override 38 | public Object searchGoods(Platform platform, PageParam pageParam) { 39 | CommonService platformService = getPlatform(platform); 40 | platformService.searchGoods(null); 41 | return null; 42 | } 43 | 44 | @Override 45 | public String authLogin(Platform platform, User user) { 46 | CommonService platformService = getPlatform(platform); 47 | return platformService.authLogin(user); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/impl/LogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.superman.superman.dao.LogDao; 6 | import com.superman.superman.model.UserLog; 7 | import com.superman.superman.model.enums.LogOperationEnum; 8 | import com.superman.superman.service.LogService; 9 | import lombok.NonNull; 10 | import lombok.extern.java.Log; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.scheduling.annotation.Async; 13 | import org.springframework.stereotype.Service; 14 | 15 | /** 16 | * Created by snake on 2018/11/24. 17 | */ 18 | @Log 19 | @Service("logService") 20 | public class LogServiceImpl extends ServiceImpl implements LogService,IService { 21 | /** 22 | * 异步上报用户登录 23 | * 24 | * @param uid 25 | * @param ip 26 | */ 27 | @Async 28 | @Override 29 | public void addUserLoginLog(Long uid, String ip) { 30 | UserLog log = new UserLog(); 31 | log.setUserId(uid); 32 | log.setOperationEnum(LogOperationEnum.USER_LOGIN); 33 | log.setIp(ip); 34 | save(log); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/impl/SysDaygoodsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service.impl; 2 | 3 | import com.alibaba.fastjson.JSONArray; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.superman.superman.dao.SysDaygoodsDao; 6 | import com.superman.superman.dto.SysDayGoodDto; 7 | import com.superman.superman.model.SysDaygoods; 8 | import com.superman.superman.service.SysDaygoodsService; 9 | import com.superman.superman.utils.PageParam; 10 | import org.springframework.beans.BeanUtils; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | import java.util.List; 14 | 15 | @Service("daygoodsService") 16 | public class SysDaygoodsServiceImpl implements SysDaygoodsService { 17 | 18 | @Autowired 19 | private SysDaygoodsDao daygoodsDao; 20 | 21 | 22 | @Override 23 | public JSONObject queryList(PageParam pageParam){ 24 | PageParam temp =new PageParam(pageParam.getPageNo(),pageParam.getPageSize()); 25 | List sysDaygoods = daygoodsDao.queryListGod(temp.getStartRow(), temp.getPageSize()); 26 | Integer count = daygoodsDao.countDayGoods(); 27 | JSONObject var=new JSONObject(); 28 | JSONArray data=new JSONArray(); 29 | if (count==null||count==0){ 30 | var.put("pageCount",0); 31 | var.put("pageData",data); 32 | return var; 33 | } 34 | for (SysDaygoods sy:sysDaygoods){ 35 | SysDayGoodDto dto=new SysDayGoodDto(); 36 | BeanUtils.copyProperties(sy,dto); 37 | List images = daygoodsDao.getImages(sy.getId()); 38 | dto.setContent_Images(images); 39 | data.add(dto); 40 | } 41 | var.put("pageCount",count); 42 | var.put("pageData",data); 43 | return var; 44 | } 45 | 46 | @Override 47 | public void update(SysDaygoods daygoods){ 48 | daygoodsDao.update(daygoods); 49 | } 50 | 51 | @Override 52 | public void delete(Integer id){ 53 | daygoodsDao.delete(id); 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/service/impl/TokenServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.service.impl; 2 | 3 | import com.superman.superman.annotation.FastCache; 4 | import com.superman.superman.model.TokenModel; 5 | import com.superman.superman.service.TokenService; 6 | import com.superman.superman.utils.Constants; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.data.redis.core.RedisTemplate; 9 | import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; 10 | import org.springframework.stereotype.Component; 11 | import org.springframework.stereotype.Service; 12 | 13 | import javax.annotation.Resource; 14 | import java.util.UUID; 15 | import java.util.concurrent.TimeUnit; 16 | 17 | /** 18 | * @Auther: le 19 | * @Date: 2018/8/17 17:10 20 | * @Description: 21 | */ 22 | @Service("tokenService") 23 | public class TokenServiceImpl implements TokenService { 24 | 25 | 26 | @Autowired 27 | private RedisTemplate redis; 28 | 29 | 30 | public void setRedis(RedisTemplate redis) { 31 | this.redis = redis; 32 | //泛型设置成Long后必须更改对应的序列化方案 33 | redis.setKeySerializer(new JdkSerializationRedisSerializer()); 34 | } 35 | 36 | 37 | public TokenModel createToken(String userId) { 38 | //使用uuid作为源token 39 | String token = UUID.randomUUID().toString().replace("-", ""); 40 | TokenModel model = new TokenModel(userId, token); 41 | //存储到redis并设置过期时间 42 | redis.boundValueOps(userId).set(token, Constants.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS); 43 | return model; 44 | } 45 | public boolean checkToken(TokenModel model) { 46 | if (model == null) { 47 | return false; 48 | } 49 | String token = redis.boundValueOps(model.getUserId()).get(); 50 | if (token == null || !token.equals(model.getToken())) { 51 | return false; 52 | } 53 | //如果验证成功,说明此用户进行了一次有效操作,延长token的过期时间 54 | redis.boundValueOps(model.getUserId()).expire(Constants.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS); 55 | return true; 56 | } 57 | 58 | public TokenModel getToken(String authentication) { 59 | if (authentication == null || authentication.length() == 0) { 60 | return null; 61 | } 62 | String[] param = authentication.split("_"); 63 | if (param.length != 2) { 64 | return null; 65 | } 66 | //使用userId和源token简单拼接成的token,可以增加加密措施 67 | String userId = param[0]; 68 | String token = param[1]; 69 | return new TokenModel(userId, token); 70 | } 71 | 72 | public void deleteToken(String userId) { 73 | redis.delete(userId); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | /** 4 | * @Auther: le 5 | * @Date: 2018/8/17 17:05 6 | * @Description: 7 | */ 8 | public class Constants { 9 | /** 10 | * 存储当前登录用户id的字段名 11 | */ 12 | public static final String CURRENT_USER_ID = "CURRENT_USER_ID"; 13 | 14 | /** 15 | * token有效期(小时) 16 | */ 17 | public static final int TOKEN_EXPIRES_HOUR = 72; 18 | 19 | /** 20 | * 存放token的header字段 21 | */ 22 | public static final String AUTHORIZATION = "token"; 23 | 24 | /** 25 | * 存放wx token 26 | */ 27 | public static final String LOGIN_TOKEN_WX="token_wx"; 28 | 29 | /** 30 | * 微信小程序的APPID 31 | */ 32 | public static final String APPID="wxc5ccc9ddb801feb8"; 33 | 34 | /** 35 | * 微信小程序的SECRET 36 | */ 37 | public static final String SECRET="6def530ef7070da04102520b5bfe1a27"; 38 | 39 | /** 40 | * 默认头像 41 | */ 42 | public static final String IMG_DEFAUT="https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1544755797&di=f6cf802a4c65f73167a94f52f07c1b21&src=http://b-ssl.duitang.com/uploads/item/201705/07/20170507160711_uU3Zy.jpeg"; 43 | 44 | 45 | /** 46 | * 默认昵称 47 | */ 48 | public static final String USERNAME_DEFAUT="匿名用户"; 49 | /** 50 | * 邀请记录 51 | */ 52 | public static final String INV_LOG="inv_log"; 53 | /** 54 | * 登录key 55 | */ 56 | public static final String SMS_LOGIN="login:"; 57 | /** 58 | * 淘宝授权请求地址 59 | */ 60 | public static final String TAOBAO_OAUTH_TOKEN_URL="https://oauth.taobao.com/token"; 61 | /** 62 | * APP官方域名 63 | */ 64 | public static final String APP_URL="http://www.quanhuangmaoyi.com"; 65 | /** 66 | * 喵有券渠道备案URL 67 | */ 68 | public static final String MIAO_BAK_URL="https://open.21ds.cn/index/extapi/tbkrelationbeian?"; 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/ErrorBean.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | /** 8 | * Created by snake on 2018/11/19. 9 | */ 10 | @Getter 11 | @Setter 12 | @ToString 13 | public class ErrorBean { 14 | 15 | public static final Integer OK = 0; 16 | public static final Integer ERROR = 100; 17 | 18 | private Integer code; 19 | private String message; 20 | private String url; 21 | private T data; 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/MyException.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | /** 4 | * Created by snake on 2018/11/19. 5 | */ 6 | public class MyException extends Exception { 7 | public MyException(String message){ 8 | super(message); 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/PageParam.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import javax.validation.constraints.NotNull; 4 | import java.io.Serializable; 5 | 6 | /** 7 | * 8 | * @author daiwenhua 9 | * 10 | */ 11 | public class PageParam implements Serializable{ 12 | 13 | /** 14 | * 15 | */ 16 | private static final long serialVersionUID = -6712010429290414297L; 17 | @NotNull 18 | int pageNo; 19 | 20 | int pageSize; 21 | 22 | int startRow; 23 | 24 | int endRow; 25 | 26 | public PageParam(){} 27 | 28 | public PageParam(int pageNo, int pageSize) { 29 | super(); 30 | this.pageNo = pageNo; 31 | this.pageSize = pageSize; 32 | this.startRow = (pageNo - 1) * pageSize; 33 | this.endRow = pageNo * pageSize; 34 | } 35 | 36 | public int getPageNo() { 37 | return pageNo; 38 | } 39 | 40 | public void setPageNo(int pageNo) { 41 | this.pageNo = pageNo; 42 | } 43 | 44 | public int getPageSize() { 45 | return pageSize; 46 | } 47 | 48 | public void setPageSize(int pageSize) { 49 | this.pageSize = pageSize; 50 | } 51 | 52 | public int getStartRow() { 53 | return startRow; 54 | } 55 | 56 | public void setStartRow(int startRow) { 57 | this.startRow = startRow; 58 | } 59 | 60 | public int getEndRow() { 61 | return endRow; 62 | } 63 | 64 | public void setEndRow(int endRow) { 65 | this.endRow = endRow; 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | /** 7 | * @author heguoliang 8 | * @Description: TODO(分页工具类) 9 | * @date 2017-6-23 15:07 10 | */ 11 | public class PageUtils implements Serializable { 12 | private static final long serialVersionUID = 1L; 13 | //总记录数 14 | private int totalCount; 15 | //每页记录数 16 | private int pageSize; 17 | //总页数 18 | private int totalPage; 19 | //当前页数 20 | private int currPage; 21 | //列表数据 22 | private List list; 23 | 24 | /** 25 | * 分页 26 | * @param list 列表数据 27 | * @param totalCount 总记录数 28 | * @param pageSize 每页记录数 29 | * @param currPage 当前页数 30 | */ 31 | public PageUtils(List list, int totalCount, int pageSize, int currPage) { 32 | this.list = list; 33 | this.totalCount = totalCount; 34 | this.pageSize = pageSize; 35 | this.currPage = currPage; 36 | this.totalPage = (int)Math.ceil((double)totalCount/pageSize); 37 | } 38 | 39 | public int getTotalCount() { 40 | return totalCount; 41 | } 42 | 43 | public void setTotalCount(int totalCount) { 44 | this.totalCount = totalCount; 45 | } 46 | 47 | public int getPageSize() { 48 | return pageSize; 49 | } 50 | 51 | public void setPageSize(int pageSize) { 52 | this.pageSize = pageSize; 53 | } 54 | 55 | public int getTotalPage() { 56 | return totalPage; 57 | } 58 | 59 | public void setTotalPage(int totalPage) { 60 | this.totalPage = totalPage; 61 | } 62 | 63 | public int getCurrPage() { 64 | return currPage; 65 | } 66 | 67 | public void setCurrPage(int currPage) { 68 | this.currPage = currPage; 69 | } 70 | 71 | public List getList() { 72 | return list; 73 | } 74 | 75 | public void setList(List list) { 76 | this.list = list; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/Query.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import org.apache.commons.lang.StringUtils; 4 | 5 | import java.util.LinkedHashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * @author heguoliang 10 | * @Description: TODO(查询参数) 11 | * @date 2017-6-23 15:07 12 | */ 13 | public class Query extends LinkedHashMap { 14 | private static final long serialVersionUID = 1L; 15 | //当前页码 16 | private int page; 17 | //每页条数 18 | private int limit; 19 | 20 | public Query(Map params){ 21 | this.putAll(params); 22 | 23 | //分页参数 24 | this.page = Integer.parseInt(params.get("page").toString()); 25 | this.limit = Integer.parseInt(params.get("limit").toString()); 26 | this.put("offset", (page - 1) * limit); 27 | this.put("page", page); 28 | this.put("limit", limit); 29 | 30 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 31 | String sidx = (String)params.get("sidx"); 32 | String order = (String)params.get("order"); 33 | if(StringUtils.isNotBlank(sidx)){ 34 | } 35 | if(StringUtils.isNotBlank(order)){ 36 | } 37 | 38 | } 39 | 40 | 41 | public int getPage() { 42 | return page; 43 | } 44 | 45 | public void setPage(int page) { 46 | this.page = page; 47 | } 48 | 49 | public int getLimit() { 50 | return limit; 51 | } 52 | 53 | public void setLimit(int limit) { 54 | this.limit = limit; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAutoDetect; 4 | import com.fasterxml.jackson.annotation.PropertyAccessor; 5 | import org.codehaus.jackson.map.ObjectMapper; 6 | import org.springframework.cache.CacheManager; 7 | import org.springframework.cache.annotation.CachingConfigurerSupport; 8 | import org.springframework.cache.annotation.EnableCaching; 9 | import org.springframework.cache.interceptor.KeyGenerator; 10 | import org.springframework.context.annotation.Bean; 11 | import org.springframework.context.annotation.Configuration; 12 | import org.springframework.data.redis.cache.RedisCacheManager; 13 | import org.springframework.data.redis.connection.RedisConnectionFactory; 14 | import org.springframework.data.redis.core.RedisTemplate; 15 | import org.springframework.data.redis.core.StringRedisTemplate; 16 | 17 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 18 | 19 | import java.lang.reflect.Method; 20 | 21 | @Configuration 22 | @EnableCaching 23 | public class RedisConfig extends CachingConfigurerSupport { 24 | 25 | 26 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/RequestUtil.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | /** 6 | * @Auther: le 7 | * @Date: 2018/7/30 11:24 8 | * @Description: 9 | */ 10 | public class RequestUtil { 11 | public static int getInt(HttpServletRequest request, String key) 12 | { 13 | try 14 | { 15 | return Integer.decode(request.getParameter(key)); 16 | } catch (Exception e) 17 | { 18 | return -1; 19 | } 20 | } 21 | 22 | public static long getLong(HttpServletRequest request, String key) 23 | { 24 | try 25 | { 26 | return Long.decode(request.getParameter(key)); 27 | } catch (Exception e) 28 | { 29 | return -1; 30 | } 31 | } 32 | 33 | public static Double getDouble(HttpServletRequest request, String key) 34 | { 35 | try 36 | { 37 | return Double.valueOf(request.getParameter(key)); 38 | } catch (Exception e) 39 | { 40 | return -1.0; 41 | } 42 | } 43 | 44 | public static boolean getBoolean(HttpServletRequest request, String key) 45 | { 46 | try 47 | { 48 | return Boolean.valueOf(request.getParameter(key)); 49 | } catch (Exception e) 50 | { 51 | return false; 52 | } 53 | } 54 | 55 | public static String getString(HttpServletRequest request, String key) 56 | { 57 | try 58 | { 59 | String result = request.getParameter(key); 60 | if (result != null) 61 | { 62 | result = result.trim(); 63 | } 64 | if ("".equals(result)) 65 | { 66 | result = null; 67 | } 68 | return result; 69 | } catch (Exception e) 70 | { 71 | return null; 72 | } 73 | } 74 | 75 | 76 | public static String getMapString(String mapKey) 77 | { 78 | try 79 | { 80 | if (mapKey != null) 81 | { 82 | mapKey = mapKey.trim(); 83 | } 84 | if ("".equals(mapKey)) 85 | { 86 | mapKey = null; 87 | } 88 | return mapKey; 89 | } catch (Exception e) 90 | { 91 | return null; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/Response.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | 4 | 5 | /** 6 | * 标准返回 7 | * @author 80132724 8 | * 9 | * @param 10 | */ 11 | public class Response { 12 | private boolean success; 13 | private ResponseCode error; 14 | private T data; 15 | 16 | public boolean isSuccess() { 17 | return success; 18 | } 19 | 20 | public void setSuccess(boolean success) { 21 | this.success = success; 22 | } 23 | 24 | public ResponseCode getError() { 25 | return error; 26 | } 27 | 28 | public void setError(ResponseCode error) { 29 | this.error = error; 30 | } 31 | 32 | public T getData() { 33 | return data; 34 | } 35 | 36 | public void setData(T data) { 37 | this.data = data; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "BaseReq [success=" + success + ", error=" + error + ", data=" + data + "]"; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/ResponseCode.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | /** 4 | * 系统返回码 5 | * 6 | * @author Yaphis 2015年9月8日 下午2:08:13 7 | */ 8 | public class ResponseCode { 9 | 10 | // 系统公用返回码 11 | public static final ResponseCode COMMON_SUCCESS = new ResponseCode("000000", "成功"); 12 | public static final ResponseCode COMMON_SYSTEM_ERROR = new ResponseCode("000001", "系统异常"); 13 | 14 | // 业务公用返回码 15 | public static final ResponseCode COMMON_PARAMS_MISSING = new ResponseCode("100000", "请求参数不全"); 16 | public static final ResponseCode COMMON_AUTHORITY_ERROR = new ResponseCode("100001", "无权限"); 17 | public static final ResponseCode COMMON_USER_NOT_EXIST = new ResponseCode("100002", "用户不存在"); 18 | public static final ResponseCode COMMON_USER_INFO_IMPERFECT = new ResponseCode("100003", "用户信息不完整"); 19 | public static final ResponseCode COMMON_USER_NOT_LOGIN = new ResponseCode("100004", "用户未登录"); 20 | public static final ResponseCode COMMON_PARAMS_ILLEGAL = new ResponseCode("100005", "请求参数非法"); 21 | public static final ResponseCode COMMON_REQUEST_FAIL = new ResponseCode("100006", "请求失败"); 22 | public static final ResponseCode COMMON_STOCK_FAIL = new ResponseCode("100007", "库存不足"); 23 | public static final ResponseCode COMMON_STOCK_OVER = new ResponseCode("100008", "购买超限"); 24 | public static final ResponseCode COMMON_STOCK_ZERO = new ResponseCode("100009", "库存为0"); 25 | public static final ResponseCode COMMON_GOODS_NULL = new ResponseCode("100010", "商品不存在或已下架"); 26 | public static final ResponseCode ADD_GOODS_TIMES = new ResponseCode("100011", "发布商品次数超限"); 27 | public static final ResponseCode NOT_STORE_PEOPLE = new ResponseCode("100012", "不是该店的人员"); 28 | public static final ResponseCode ADD_GOODS_ERROR = new ResponseCode("100013", "新增商品异常"); 29 | public static final ResponseCode ADD_STYLE_ERROR = new ResponseCode("100014", "新增店铺商品布局异常"); 30 | public static final ResponseCode ADD_ADDRESS_ERROR = new ResponseCode("100015", "收货地址最多10条"); 31 | public static final ResponseCode TOKEN_ERROR = new ResponseCode("100016", "token无效"); 32 | public static final ResponseCode TOKEN_NULL = new ResponseCode("100017", "缺少token参数"); 33 | public static final ResponseCode TAG_EXIST = new ResponseCode("100018", "标签已存在"); 34 | public static final ResponseCode GET_ACESS_TOKEN_ERROR = new ResponseCode("100019", "获取acess_token失败"); 35 | public static final ResponseCode CREATE_CODE_ERROR = new ResponseCode("100020", "生成店铺小程序码异常"); 36 | public static final ResponseCode STORE_NOT_EXISTS = new ResponseCode("100021", "店铺不存在"); 37 | public static final ResponseCode TAG_OUTSIZE = new ResponseCode("100022", "可创建的标签已到上限"); 38 | public static final ResponseCode LOGIN_ERROR = new ResponseCode("100023", "登录失败"); 39 | public static final ResponseCode EDIT_USERINFO_ERROR = new ResponseCode("100024", "更新用户信息异常"); 40 | public static final ResponseCode ADD_RECORD_ERROR = new ResponseCode("100025", "添加关注失败"); 41 | public static final ResponseCode APPLY_SUCCESS = new ResponseCode("100026", "提交成功"); 42 | public static final ResponseCode APPLY_FAIL = new ResponseCode("100027", "提交失败或者已经提交过"); 43 | public static final ResponseCode COMMON_USER_PASSWORD_ERROR = new ResponseCode("100028", "密码错误"); 44 | public static final ResponseCode DELETE_ERROR = new ResponseCode("100033", "删除错误"); 45 | public static final ResponseCode PERMISSIONS_ERROR = new ResponseCode("100053", "无权限"); 46 | public static final ResponseCode INT_CUSY = new ResponseCode("100054", "数值超出范围"); 47 | public static final ResponseCode MONEY_MAX = new ResponseCode("100064", "提现金额太小或者太大"); 48 | 49 | private String errCode; 50 | private String errMsg; 51 | 52 | public ResponseCode(String errCode, String errMsg) { 53 | super(); 54 | this.errCode = errCode; 55 | this.errMsg = errMsg; 56 | } 57 | 58 | public String getErrCode() { 59 | return errCode; 60 | } 61 | 62 | public String getErrMsg() { 63 | return errMsg; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return "[errCode=" + errCode + ", errMsg=" + errMsg + "]"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/ResponseUtil.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | 4 | public class ResponseUtil { 5 | 6 | /** 7 | * 成功返回 8 | * 9 | * @return 10 | */ 11 | public static Response success() { 12 | Response result = new Response(); 13 | result.setSuccess(true); 14 | return result; 15 | } 16 | 17 | /** 18 | * 成功返回 19 | * 20 | * @return 21 | */ 22 | public static Response success(Object o) { 23 | Response result = new Response(); 24 | result.setSuccess(true); 25 | result.setData(o); 26 | return result; 27 | } 28 | 29 | /** 30 | * 失败返回 31 | * 32 | * @param responseCode 33 | * @return 34 | */ 35 | public static Response fail(ResponseCode responseCode) { 36 | Response result = new Response(); 37 | result.setSuccess(false); 38 | result.setError(responseCode); 39 | return result; 40 | } 41 | 42 | /** 43 | * 失败返回 44 | * @param code 45 | * @param message 46 | * @return 47 | */ 48 | public static Response fail(String code, String message) { 49 | Response result = new Response(); 50 | result.setSuccess(false); 51 | result.setError(new ResponseCode(code, message)); 52 | return result; 53 | } 54 | 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/Result.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import org.apache.http.HttpStatus; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * @author heguoliang 10 | * @Description: TODO(返回数据) 11 | * @date 2017-6-23 15:07 12 | */ 13 | public class Result extends HashMap { 14 | 15 | private final static int CODE_SUCCESS=0; 16 | 17 | public static Result error() { 18 | return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员"); 19 | } 20 | 21 | public static Result error(String msg) { 22 | return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg); 23 | } 24 | 25 | public static Result error(int code, String msg) { 26 | Result r = new Result(); 27 | r.put("code", code); 28 | r.put("msg", msg); 29 | return r; 30 | } 31 | 32 | public static Result ok() { 33 | return ok("操作成功"); 34 | } 35 | 36 | public static Result ok(String msg) { 37 | Result r = new Result(); 38 | r.put("code", CODE_SUCCESS); 39 | r.put("msg", msg); 40 | return r; 41 | } 42 | 43 | public Result put(Map map) { 44 | super.putAll(map); 45 | return this; 46 | } 47 | 48 | public Result put(String key, Object value) { 49 | super.put(key, value); 50 | return this; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/ShareCodeUtils.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import java.util.Random; 4 | 5 | public class ShareCodeUtils { 6 | /** 7 | * 邀请码生成器,基本原理:
8 | * 1)入参用户ID:1
9 | * 2)使用自定义进制转换之后为:V
10 | * 3)转换未字符串,并在后面添加'A':VA
11 | * 4)在VA后面再随机补足4位,得到:VAHKHE
12 | * 5)反向转换时以'A'为分界线,'A'后面的不再解析
13 | * 14 | * @author zzs 15 | */ 16 | /** 17 | * 自定义进制(0,1没有加入,容易与o,l混淆),数组顺序可进行调整增加反推难度,A用来补位因此此数组不包含A,共31个字符。 18 | */ 19 | private static final char[] BASE = new char[]{'H', 'V', 'E', '8', 'S', '2', 'D', 'Z', 'X', '9', 'C', '7', 'P', 20 | '5', 'I', 'K', '3', 'M', 'J', 'U', 'F', 'R', '4', 'W', 'Y', 'L', 'T', 'N', '6', 'B', 'G', 'Q'}; 21 | 22 | /** 23 | * A补位字符,不能与自定义重复 24 | */ 25 | private static final char SUFFIX_CHAR = 'A'; 26 | 27 | /** 28 | * 进制长度 29 | */ 30 | private static final int BIN_LEN = BASE.length; 31 | 32 | /** 33 | * 生成邀请码最小长度 34 | */ 35 | private static final int CODE_LEN = 6; 36 | 37 | /** 38 | * ID转换为邀请码 39 | * 40 | * @param id 41 | * @return 42 | */ 43 | public static String idToCode(Long id) { 44 | char[] buf = new char[BIN_LEN]; 45 | int charPos = BIN_LEN; 46 | 47 | // 当id除以数组长度结果大于0,则进行取模操作,并以取模的值作为数组的坐标获得对应的字符 48 | while (id / BIN_LEN > 0) { 49 | int index = (int) (id % BIN_LEN); 50 | buf[--charPos] = BASE[index]; 51 | id /= BIN_LEN; 52 | } 53 | 54 | buf[--charPos] = BASE[(int) (id % BIN_LEN)]; 55 | // 将字符数组转化为字符串 56 | String result = new String(buf, charPos, BIN_LEN - charPos); 57 | 58 | // 长度不足指定长度则随机补全 59 | int len = result.length(); 60 | if (len < CODE_LEN) { 61 | StringBuilder sb = new StringBuilder(); 62 | sb.append(SUFFIX_CHAR); 63 | Random random = new Random(); 64 | // 去除SUFFIX_CHAR本身占位之后需要补齐的位数 65 | for (int i = 0; i < CODE_LEN - len - 1; i++) { 66 | sb.append(BASE[random.nextInt(BIN_LEN)]); 67 | } 68 | 69 | result += sb.toString(); 70 | } 71 | 72 | return result; 73 | } 74 | 75 | /** 76 | * 邀请码解析出ID
77 | * 基本操作思路恰好与idToCode反向操作。 78 | * 79 | * @param code 80 | * @return 81 | */ 82 | public static Long codeToId(String code) { 83 | char[] charArray = code.toCharArray(); 84 | long result = 0L; 85 | for (int i = 0; i < charArray.length; i++) { 86 | int index = 0; 87 | for (int j = 0; j < BIN_LEN; j++) { 88 | if (charArray[i] == BASE[j]) { 89 | index = j; 90 | break; 91 | } 92 | } 93 | 94 | if (charArray[i] == SUFFIX_CHAR) { 95 | break; 96 | } 97 | 98 | if (i > 0) { 99 | result = result * BIN_LEN + index; 100 | } else { 101 | result = index; 102 | } 103 | } 104 | 105 | return result; 106 | 107 | } 108 | 109 | public static void main(String[] args) { 110 | String code = idToCode(213254634155231l); 111 | System.out.println(code); 112 | System.out.println(codeToId(code)); 113 | } 114 | 115 | } -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/SmsSendDemo.java: -------------------------------------------------------------------------------- 1 | //package com.superman.superman.utils; 2 | //import com.alibaba.fastjson.JSON; 3 | //import com.alibaba.fastjson.JSONObject; 4 | //import com.superman.superman.utils.sms.ChuangLanSmsUtil; 5 | //import com.superman.superman.utils.sms.SmsSendRequest; 6 | //import com.superman.superman.utils.sms.SmsSendResponse; 7 | // 8 | // 9 | ///** 10 | // * 11 | // * @author tianyh 12 | // * @Description:普通短信发送 13 | // */ 14 | //public class SmsSendDemo { 15 | // public static final String charset = "utf-8"; 16 | // // 请登录zz.253.com 获取创蓝API账号(非登录账号,示例:N1234567) 17 | // // 请登录zz.253.com 获取创蓝API账号(非登录账号,示例:N1234567) 18 | // public static String account = "N451442_N0360303"; 19 | // 20 | // // 请登录zz.253.com 获取创蓝API密码(非登录密码) 21 | // public static String pswd = "beLtQz6w8d914f"; 22 | // 23 | // public static SmsSendResponse getSms(String phone, String code) { 24 | // // 短信发送的URL 请登录zz.253.com 获取完整的URL接口信息 25 | // String smsSingleRequestServerUrl = "http://smssh1.253.com/msg/send/json"; 26 | // 27 | // // 设置您要发送的内容:其中“【】”中括号为运营商签名符号,多签名内容前置添加提交 28 | // // String msg = "【253云通讯】你好,你的验证码是:"+num; 29 | // String msg = "此次登录验证码"+code+",验证码两分钟过期" ; 30 | // String report = "true"; 31 | // SmsSendRequest smsSingleRequest = new SmsSendRequest(account, pswd, msg, phone, report); 32 | // String requestJson = JSON.toJSONString(smsSingleRequest); 33 | // String response = ChuangLanSmsUtil.sendSmsByPost(smsSingleRequestServerUrl, requestJson); 34 | // SmsSendResponse smsSingleResponse = JSON.parseObject(response, SmsSendResponse.class); 35 | // return smsSingleResponse; 36 | // } 37 | //} 38 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/SmsUtil.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | import org.apache.commons.httpclient.HttpClient; 6 | import org.apache.commons.httpclient.NameValuePair; 7 | import org.apache.commons.httpclient.methods.PostMethod; 8 | 9 | import java.text.SimpleDateFormat; 10 | import java.util.Date; 11 | 12 | public class SmsUtil { 13 | public static final String accounts ="uucj"; 14 | public static final String password ="huazhongno1"; 15 | public static final String productId = "887362"; 16 | 17 | public static int sendSms(String phone,String con){ 18 | int result = 0; 19 | try { 20 | String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); 21 | String Url = "http://www.ztsms.cn/sendNSms.do?productid=887362"; 22 | String pwd= DigestUtils.md5Hex(DigestUtils.md5Hex("huazhongno1")+date); 23 | HttpClient client =new HttpClient(); 24 | PostMethod post = new PostMethod(Url); 25 | post.setRequestHeader("Content-type", 26 | "application/x-www-form-urlencoded;charset=utf-8"); 27 | NameValuePair userid = new NameValuePair("username", "uucj"); 28 | NameValuePair account = new NameValuePair("password", pwd); 29 | NameValuePair password = new NameValuePair("tkey",date ); 30 | NameValuePair mobile = new NameValuePair("mobile", phone); 31 | NameValuePair content = new NameValuePair("content", con); 32 | NameValuePair sendTime = new NameValuePair("xh", ""); 33 | post.setRequestBody(new NameValuePair[] { userid, account, password,mobile, content, sendTime }); 34 | result= client.executeMethod(post);//发送请求 35 | /*System.out.println("----------发送结果-----------"+result);*/ 36 | } catch (Exception e) { 37 | e.printStackTrace(); 38 | } 39 | return result; 40 | } 41 | 42 | 43 | public static int sendSmsLogin(String phone,String con){ 44 | int result = 0; 45 | try { 46 | String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); 47 | String Url = "http://www.ztsms.cn/sendNSms.do?productid=676767"; 48 | String pwd= DigestUtils.md5Hex(DigestUtils.md5Hex("huazhongno1")+date); 49 | HttpClient client =new HttpClient(); 50 | PostMethod post = new PostMethod(Url); 51 | post.setRequestHeader("Content-type", 52 | "application/x-www-form-urlencoded;charset=utf-8"); 53 | NameValuePair userid = new NameValuePair("username", "uucj"); 54 | NameValuePair account = new NameValuePair("password", pwd); 55 | NameValuePair password = new NameValuePair("tkey",date ); 56 | NameValuePair mobile = new NameValuePair("mobile", phone); 57 | NameValuePair content = new NameValuePair("content", con); 58 | NameValuePair sendTime = new NameValuePair("xh", ""); 59 | post.setRequestBody(new NameValuePair[] { userid, account, password,mobile, content, sendTime }); 60 | result= client.executeMethod(post);//发送请求 61 | /*System.out.println("----------发送结果-----------"+result);*/ 62 | } catch (Exception e) { 63 | e.printStackTrace(); 64 | } 65 | return result; 66 | } 67 | 68 | /** 69 | * 微信端登录发送短信验证码 70 | * @param mobile 71 | * @return 72 | */ 73 | public static JSONObject sendLoginSmsVcode(String mobile){ 74 | JSONObject json = new JSONObject(); 75 | int code = (int)((Math.random()*9+1)*100000); 76 | /*System.out.println(code);*/ 77 | String content = "此次登录验证码"+code+",验证码五分钟过期【优优车检】"; 78 | int result = sendSmsLogin(mobile, content); 79 | json.put("sendResult", result); 80 | json.put("code", code); 81 | return json; 82 | } 83 | /** 84 | * 向车检站发送下单短信通知 85 | * @param mobile 86 | * @return 87 | */ 88 | public static void inform(String mobile,String nickName,String phone,String plateNumber,String yyTime){ 89 | 90 | // String content = "【优优车检】新订单通知," 91 | // + "下单用户-"+nickName+",联系方式-"+phone+",车牌号-"+plateNumber+",预约时间-"+yyTime; 92 | String content ="【优优车检】新订单通知\r\n" + 93 | "下单用户:"+nickName+"\r\n" + 94 | "联系方式:"+phone+"\r\n" + 95 | "车牌号: "+plateNumber+"\r\n" + 96 | "预约时间:"+yyTime; 97 | 98 | int result = sendSms(mobile, content); 99 | 100 | } 101 | 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/StringUtil.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import java.text.ParsePosition; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * Created by snake on 2018/11/6. 11 | */ 12 | public class StringUtil { 13 | /** 14 | * 获取现在时间 15 | * 16 | * @return返回长时间格式 yyyy-MM-dd HH:mm:ss 17 | */ 18 | public static String datetoYYYMMMDDHHMMSS(Date currentTime) { 19 | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 20 | String dateString = formatter.format(currentTime); 21 | return dateString; 22 | } 23 | //判断字符串是否为�? 24 | public static String isStrNull(String str){ 25 | return (str == null ? "" : str.toString().trim()); 26 | } 27 | 28 | public static String isStrNull(Object str){ 29 | return (str == null ? "" : str.toString().trim()); 30 | } 31 | 32 | public static String subStr(String str , int length){ 33 | String stri = null; 34 | if(!StringUtil.isStrNull(str).equals("")){ 35 | if(str.length() > length){ 36 | stri = str.substring(0, length)+"..."; 37 | }else{ 38 | stri = str; 39 | } 40 | }else{ 41 | stri = ""; 42 | } 43 | return stri; 44 | } 45 | public static String replace(String source,String target,int start,int end){ 46 | if(source==null||source.length()<1) return source; 47 | if(start==end) return source; 48 | StringBuffer buffer = new StringBuffer(); 49 | for (int i = 0; i < source.length(); i++) { 50 | char c = source.charAt(i); 51 | if(i==start&&start!=end) { 52 | buffer.append(target); 53 | start++; 54 | }else{ 55 | buffer.append(c); 56 | } 57 | } 58 | return buffer.toString(); 59 | } 60 | 61 | public static String replaceBlank(String str) { 62 | String dest = ""; 63 | if (str != null) { 64 | Pattern p = Pattern.compile("\\s*|\t|\r|\n"); 65 | Matcher m = p.matcher(str); 66 | dest = m.replaceAll(""); 67 | } 68 | return dest; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/TokenState.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | /** 4 | * 枚举,定义token的三种状态 5 | * @author running@vip.163.com 6 | * 7 | */ 8 | public enum TokenState { 9 | /** 10 | * 过期 11 | */ 12 | EXPIRED("EXPIRED"), 13 | /** 14 | * 无效(token不合法) 15 | */ 16 | INVALID("INVALID"), 17 | /** 18 | * 有效的 19 | */ 20 | VALID("VALID"); 21 | 22 | private String state; 23 | 24 | private TokenState(String state) { 25 | this.state = state; 26 | } 27 | 28 | /** 29 | * 根据状态字符串获取token状态枚举对象 30 | * @param tokenState 31 | * @return 32 | */ 33 | public static TokenState getTokenState(String tokenState){ 34 | TokenState[] states=TokenState.values(); 35 | TokenState ts=null; 36 | for (TokenState state : states) { 37 | if(state.toString().equals(tokenState)){ 38 | ts=state; 39 | break; 40 | } 41 | } 42 | return ts; 43 | } 44 | public String toString() { 45 | return this.state; 46 | } 47 | public String getState() { 48 | return state; 49 | } 50 | public void setState(String state) { 51 | this.state = state; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/XmlUtil.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils; 2 | 3 | import java.net.URL; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import org.dom4j.Document; 8 | import org.dom4j.DocumentException; 9 | import org.dom4j.DocumentHelper; 10 | import org.dom4j.Element; 11 | import org.dom4j.io.SAXReader; 12 | 13 | public class XmlUtil { 14 | 15 | public Document parseFromUrl(URL url) throws DocumentException { 16 | SAXReader reader = new SAXReader(); 17 | return reader.read(url); 18 | } 19 | 20 | public static Document parseFromText(String text) throws DocumentException { 21 | return DocumentHelper.parseText(text); 22 | } 23 | 24 | public static Map treeWalkStart(String text) throws DocumentException { 25 | Document document = parseFromText(text); 26 | Element rootElement = document.getRootElement(); 27 | Map keyval = new HashMap(); 28 | Element nonce_str = rootElement.element("nonce_str"); 29 | Element prepay_id = rootElement.element("prepay_id"); 30 | keyval.put("nonce_str",nonce_str.getText()); 31 | keyval.put("prepay_id",prepay_id.getText()); 32 | return keyval; 33 | } 34 | 35 | public static Map doXMLParse(String text) throws DocumentException { 36 | Document document = parseFromText(text); 37 | Element rootElement = document.getRootElement(); 38 | Map keyval = new HashMap(); 39 | Element nonce_str = rootElement.element("result_code"); 40 | Element prepay_id = rootElement.element("return_code"); 41 | Element out_trade_no = rootElement.element("out_trade_no"); 42 | Element attach = rootElement.element("attach"); 43 | keyval.put("result_code",nonce_str.getText()); 44 | keyval.put("return_code",prepay_id.getText()); 45 | keyval.put("out_trade_no",out_trade_no.getText()); 46 | keyval.put("attach",attach.getText()); 47 | return keyval; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/net/NetUtils.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils.net; 2 | 3 | import org.apache.commons.lang.NullArgumentException; 4 | 5 | import java.io.UnsupportedEncodingException; 6 | import java.net.URLEncoder; 7 | import java.util.ArrayList; 8 | import java.util.Collections; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * Created by snake on 2018/12/12. 14 | */ 15 | public class NetUtils { 16 | //Map转换成 URL 17 | public static String convertUrlParam(Map params){ 18 | 19 | List keys = new ArrayList(params.keySet()); 20 | Collections.sort(keys); 21 | String prestr = ""; 22 | for (int i = 0; i < keys.size(); i++) { 23 | String key = keys.get(i); 24 | String value = params.get(key); 25 | 26 | if (i == keys.size() - 1) {//拼接时,不包括最后一个&字符 27 | prestr = prestr + key + "=" + value; 28 | } else { 29 | prestr = prestr + key + "=" + value + "&"; 30 | } 31 | } 32 | return prestr; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/sign/EverySign.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils.sign; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import org.springframework.util.DigestUtils; 5 | 6 | import java.util.*; 7 | import java.util.regex.Matcher; 8 | import java.util.regex.Pattern; 9 | 10 | /** 11 | * Created by snake on 2018/11/8. 12 | */ 13 | public class EverySign { 14 | public static Map isPhone(String phone) { 15 | String regex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$"; 16 | Map set=new HashMap(); 17 | if (phone.length() != 11) { 18 | set.put("data","手机号应为11位数"); 19 | set.put("flag",false); 20 | return set; 21 | } else { 22 | Pattern p = Pattern.compile(regex); 23 | Matcher m = p.matcher(phone); 24 | boolean isMatch = m.matches(); 25 | if (!isMatch) { 26 | set.put("data","请填入正确的手机号"); 27 | set.put("flag",false); 28 | return set; 29 | } 30 | set.put("flag",true); 31 | return set; 32 | } 33 | } 34 | 35 | 36 | public static String pddSign(SortedMap urlSign, String SECRET){ 37 | StringBuilder stringBuilder = new StringBuilder(); 38 | stringBuilder.append(SECRET); 39 | Set> entry = urlSign.entrySet(); 40 | //通过迭代器取出map中的键值关系,迭代器接收的泛型参数应和Set接收的一致 41 | Iterator> it = entry.iterator(); 42 | while (it.hasNext()) { 43 | //将键值关系取出存入Map.Entry这个映射关系集合接口中 44 | Map.Entry me = it.next(); 45 | //使用Map.Entry中的方法获取键和值 46 | String param = me.getKey() + me.getValue(); 47 | stringBuilder.append(param); 48 | } 49 | stringBuilder.append(SECRET); 50 | String hex = DigestUtils.md5DigestAsHex(stringBuilder.toString().getBytes()); 51 | return hex.toUpperCase(); 52 | } 53 | 54 | 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/sign/MD5.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils.sign; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | public class MD5 { 7 | 8 | private MD5() {} 9 | 10 | public final static String getMessageDigest(byte[] buffer) { 11 | char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 12 | try { 13 | MessageDigest mdTemp = MessageDigest.getInstance("MD5"); 14 | mdTemp.update(buffer); 15 | byte[] md = mdTemp.digest(); 16 | int j = md.length; 17 | char str[] = new char[j * 2]; 18 | int k = 0; 19 | for (int i = 0; i < j; i++) { 20 | byte byte0 = md[i]; 21 | str[k++] = hexDigits[byte0 >>> 4 & 0xf]; 22 | str[k++] = hexDigits[byte0 & 0xf]; 23 | } 24 | return new String(str); 25 | } catch (Exception e) { 26 | return null; 27 | } 28 | } 29 | 30 | public static String md5(String string) { 31 | byte[] hash; 32 | try { 33 | hash = MessageDigest.getInstance("MD5").digest(string.getBytes()); 34 | } catch (NoSuchAlgorithmException e) { 35 | throw new RuntimeException("Huh, MD5 should be supported?", e); 36 | } 37 | StringBuilder hex = new StringBuilder(hash.length * 2); 38 | for (byte b : hash) { 39 | if ((b & 0xFF) < 0x10) hex.append("0"); 40 | hex.append(Integer.toHexString(b & 0xFF)); 41 | } 42 | 43 | return hex.toString(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/sign/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.superman.superman.utils.sign; 2 | 3 | 4 | 5 | 6 | import java.security.MessageDigest; 7 | import java.util.Iterator; 8 | import java.util.Map; 9 | import java.util.Set; 10 | import java.util.SortedMap; 11 | 12 | public class MD5Util { 13 | 14 | private static String byteArrayToHexString(byte b[]) { 15 | StringBuffer resultSb = new StringBuffer(); 16 | for (int i = 0; i < b.length; i++) 17 | resultSb.append(byteToHexString(b[i])); 18 | 19 | return resultSb.toString(); 20 | } 21 | 22 | private static String byteToHexString(byte b) { 23 | int n = b; 24 | if (n < 0) 25 | n += 256; 26 | int d1 = n / 16; 27 | int d2 = n % 16; 28 | return hexDigits[d1] + hexDigits[d2]; 29 | } 30 | 31 | public static String MD5Encode(String origin, String charsetname) { 32 | String resultString = null; 33 | try { 34 | resultString = new String(origin); 35 | MessageDigest md = MessageDigest.getInstance("MD5"); 36 | if (charsetname == null || "".equals(charsetname)) 37 | resultString = byteArrayToHexString(md.digest(resultString 38 | .getBytes())); 39 | else 40 | resultString = byteArrayToHexString(md.digest(resultString 41 | .getBytes(charsetname))); 42 | } catch (Exception exception) { 43 | } 44 | return resultString; 45 | } 46 | 47 | private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5", 48 | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; 49 | 50 | 51 | /** 52 | * 微信支付签名算法sign 53 | * @param characterEncoding 54 | * @param parameters 55 | * @return 56 | */ 57 | @SuppressWarnings("rawtypes") 58 | public static String createSign(String characterEncoding,SortedMap parameters,String key){ 59 | StringBuffer sb = new StringBuffer(); 60 | Set es = parameters.entrySet();//所有参与传参的参数按照accsii排序(升序) 61 | Iterator it = es.iterator(); 62 | while(it.hasNext()) { 63 | Map.Entry entry = (Map.Entry)it.next(); 64 | String k = (String)entry.getKey(); 65 | Object v = entry.getValue(); 66 | if(null != v && !"".equals(v) 67 | && !"sign".equals(k) && !"key".equals(k)) { 68 | sb.append(k + "=" + v + "&"); 69 | } 70 | 71 | } 72 | sb.append("key="+key); 73 | String sign = MD5Util.MD5Encode(sb.toString(), characterEncoding).toUpperCase(); 74 | return sign; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/sign/RandomUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.superman.superman.utils.sign; 5 | 6 | import org.apache.commons.lang.StringUtils; 7 | 8 | import java.text.SimpleDateFormat; 9 | import java.util.Date; 10 | import java.util.Random; 11 | import java.util.UUID; 12 | 13 | /** 14 | * @Description: TODO(随机数工具类) 15 | * @author heguoliang 16 | * @date 2016年10月10日 上午8:50:13 17 | */ 18 | public class RandomUtils { 19 | 20 | private static final Random RANDOM=new Random(); 21 | 22 | public static Random getRandom() { 23 | return RANDOM; 24 | } 25 | 26 | private static char[] chars = { 27 | 'a', 'b', 'c', 'd', 'e', 'f', 'g', 28 | 'h', 'i', 'j', 'k', 'l', 'm', 'n', 29 | 'o', 'p', 'q', 'r', 's', 't', 'u', 30 | 'v', 'w', 'x', 'y', 'z', 31 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 32 | 'A', 'B', 'C', 'D', 'E', 'F', 'G', 33 | 'H', 'I', 'J', 'K', 'L', 'M', 'N', 34 | 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 35 | 'V', 'W', 'X', 'Y', 'Z' 36 | }; 37 | 38 | /** 39 | * 随机生成由0-9a-zA-Z组合而成的字符串 40 | * 41 | * @param len 字符串长度 42 | * @return 生成结果 43 | */ 44 | public static String randomChar(int len) { 45 | StringBuilder shortBuffer = new StringBuilder(); 46 | String uuid = UUID.randomUUID().toString().replace("-", ""); 47 | for (int i = 0; i < len; i++) { 48 | String str = uuid.substring(i * 4, i * 4 + 4); 49 | int x = Integer.parseInt(str, 16); 50 | shortBuffer.append(chars[x % 0x3E]); 51 | } 52 | return shortBuffer.toString(); 53 | } 54 | 55 | /** 56 | * 随机数+日期 57 | * @param startaKey 58 | * @param endKey 59 | * @return 60 | */ 61 | public static String randomKey(String startaKey, String endKey) { 62 | String simpleDate = new SimpleDateFormat("yyMMddHHmmss").format(new Date()); 63 | String result = simpleDate + randomSixNum(); 64 | if (StringUtils.isNotBlank(startaKey)) { 65 | result = startaKey + result; 66 | } 67 | if (StringUtils.isNotBlank(endKey)) { 68 | result = result + endKey; 69 | } 70 | return result; 71 | } 72 | 73 | public static Integer randomKey(int count) { 74 | Integer result = getRandom().nextInt(count); 75 | return result + 1; 76 | } 77 | 78 | /** 79 | * 随机生成六位随机数 80 | * @return 81 | */ 82 | public static int randomSixNum() { 83 | int randomNum = (int) ((Math.random() * 9 + 1) * 100000); 84 | return randomNum; 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/superman/superman/utils/sms/SmsSend.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GGsnake/ShopMall/607c4d85778df12b76363be8aaec246a4dec0cb7/src/main/java/com/superman/superman/utils/sms/SmsSend.java -------------------------------------------------------------------------------- /src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: prod 3 | mvc: 4 | view: 5 | prefix: /user/ 6 | suffix: .html 7 | datasource: 8 | name: mysql_test 9 | type: com.alibaba.druid.pool.DruidDataSource 10 | #druid相关配置 11 | druid: 12 | #监控统计拦截的filters 13 | filters: stat 14 | driver-class-name: com.mysql.jdbc.Driver 15 | #基本属性 16 | url: jdbc:mysql://47.422.322.103:3306/coupon?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true 17 | username: root 18 | # password: root 19 | password: xxxxxxxx 20 | #配置初始化大小/最小/最大 21 | initial-size: 1 22 | min-idle: 1 23 | max-active: 20 24 | #获取连接等待超时时间 25 | max-wait: 60000 26 | #间隔多久进行一次检测,检测需要关闭的空闲连接 27 | time-between-eviction-runs-millis: 60000 28 | #一个连接在池中最小生存的时间 29 | min-evictable-idle-time-millis: 300000 30 | validation-query: SELECT 'x' 31 | test-while-idle: true 32 | test-on-borrow: false 33 | test-on-return: false 34 | #打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false 35 | pool-prepared-statements: false 36 | max-pool-prepared-statement-per-connection-size: 20 37 | redis: 38 | database: 0 39 | # host: 121.201.43.229 40 | host: 127.0.0.1 41 | port: 6379 42 | # password: huazhongBAO 43 | password: 44 | pool: 45 | max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) 46 | max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) 47 | max-idle: 10 # 连接池中的最大空闲连接 48 | min-idle: 5 # 连接池中的最小空闲连接 49 | timeout: 20000 50 | 51 | 52 | logging: 53 | level: 54 | com.superman.superman: debug 55 | file: ./logs/core.log 56 | root: INFO 57 | 58 | 59 | server: 60 | port: 8088 61 | 62 | mybatis-plus: 63 | typeEnumsPackage: com.superman.superman.model.enums 64 | 65 | # 66 | #mybatis: 67 | # mapper-locations: classpath:mapper/*.xml 68 | # type-aliases-package: com.superman.superman.model 69 | 70 | juanhuang: 71 | range: 90 72 | look: "score_look" 73 | sign: "score_sign" 74 | invscore: 20 75 | 76 | domain: 77 | url: "http://1232320.79.62.89/" 78 | codeurl: "http://www.dd.com" 79 | localurl: "http://192.168.0.102" 80 | jdimageurl: "http://img14.360buyimg.com/n1/" 81 | jdUrl: "https://router.jd.com/api" 82 | jdsecret: "b4089a6f60e148318071f26a5805f6e1" 83 | jdkey: "bdead8780fda4a068b83f3f7874f311e" 84 | jduid: "1001347399" 85 | qnyurl: "http://qny.ds.com/" 86 | 87 | pdd_pro: 88 | pdd-key: "8f8a9efa079b4fb8a2d9fa86352b5e00" 89 | pdd-secret: "36f5e05bfcce59ec6a0d6f27f380362c831239d7" 90 | pdd-access_token: "fd5d312adc6e4200bcf314cf943a287593ee3f07" 91 | pdd-url: "http://quanhuangmaoyi.com" 92 | pdd-router-url: "https://gw-api.pinduoduo.com/api/router" 93 | tb: 94 | appkey: "25645650" 95 | secret: "8a9d6928c954bbf4052d2a2c8841f754" 96 | adzoneid: "328000440" 97 | api-url: "http://gw.api.taobao.com/router/rest" 98 | pid: 92706150203 99 | 100 | miao: 101 | apkey: "c003483d-fd72-c78a-72ec-1d0e6034919d" 102 | tbname: "sd" 103 | url: "https://api.open.21ds.cn/apiv1/" 104 | openurl: "https://api.open.21ds.cn/op_api_v1/" 105 | 106 | weixin: 107 | wx-key: "bbc1737d63e44e278dbffa9e96a7eca3" 108 | wx-secret: "5e1a03eb561bac0c63c5efc8c1472119fc3ad405" 109 | wx-access_token: "fd5d312adc6e4200bcf314cf943a287593ee3f07" -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: prod 4 | -------------------------------------------------------------------------------- /src/main/resources/generatorConfig_mysql.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CollectMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | id, userId,goodId,title,src, price, coupon_price, image,promotion_rate,coupon,createTime,volume 6 | 7 | 10 | 11 | 12 | delete from collect where id = #{id} 13 | 14 | 15 | 16 | insert into collect 17 | 18 | userId,goodId,createTime,image,title,src,price, 19 | 20 | volume, 21 | 22 | 23 | coupon_price, 24 | 25 | 26 | promotion_rate, 27 | 28 | 29 | coupon 30 | 31 | 32 | 33 | #{col.userId},#{col.goodId},now(), #{col.image},#{col.title},#{col.src}, #{col.price}, 34 | 35 | #{col.volume} , 36 | 37 | 38 | #{col.coupon_price}, 39 | 40 | 41 | #{col.promotion_rate}, 42 | 43 | 44 | #{col.coupon}, 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/main/resources/mapper/OrderSuperDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ScoreMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 27 | 28 | insert into score_user 29 | 30 | userId,createTime, 31 | 32 | score, 33 | 34 | 35 | dataSrc, 36 | 37 | 38 | dataRemarks, 39 | 40 | 41 | scoreType, 42 | 43 | 44 | day, 45 | 46 | 47 | 48 | #{score.userId},now(), 49 | 50 | #{score.score} , 51 | 52 | 53 | #{score.dataSrc}, 54 | 55 | 56 | #{score.dataRemarks}, 57 | 58 | 59 | #{score.scoreType}, 60 | 61 | 62 | #{score.day}, 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SysAdviceDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 33 | 34 | 37 | 38 | 49 | 55 | 56 | 57 | insert into advice 58 | ( 59 | `title`, 60 | `content`, 61 | `img`, 62 | `status`, 63 | `createTime` 64 | ) 65 | values 66 | ( 67 | #{title}, 68 | #{content}, 69 | #{img}, 70 | #{status}, 71 | #{createtime} 72 | ) 73 | 74 | 75 | 76 | update advice 77 | 78 | `title` = #{title}, 79 | `content` = #{content}, 80 | `img` = #{img}, 81 | `status` = #{status}, 82 | `createTime` = #{createtime} 83 | 84 | where id = #{id} 85 | 86 | 87 | 88 | delete from advice where id = #{value} 89 | 90 | 91 | 92 | delete from advice where id in 93 | 94 | #{id} 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/main/resources/mapper/SysDaygoodsDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 34 | 35 | 36 | 37 | insert into daygoods 38 | ( 39 | `titile`, 40 | `content`, 41 | `image`, 42 | `content_images`, 43 | `status`, 44 | `createTime` 45 | ) 46 | values 47 | ( 48 | #{titile}, 49 | #{content}, 50 | #{image}, 51 | #{contentImages}, 52 | #{status}, 53 | #{createtime} 54 | ) 55 | 56 | 57 | 58 | update daygoods 59 | 60 | `titile` = #{titile}, 61 | `content` = #{content}, 62 | `image` = #{image}, 63 | `content_images` = #{contentImages}, 64 | `status` = #{status}, 65 | `createTime` = #{createtime} 66 | 67 | where id = #{id} 68 | 69 | 70 | 71 | delete from daygoods where id = #{value} 72 | 73 | 74 | 75 | delete from daygoods where id in 76 | 77 | #{id} 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /src/main/resources/mysql-connector-java-5.0.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GGsnake/ShopMall/607c4d85778df12b76363be8aaec246a4dec0cb7/src/main/resources/mysql-connector-java-5.0.8.jar -------------------------------------------------------------------------------- /src/main/resources/static/user/layer.mobile-v2.0/demo.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://layer.layui.com/mobile/ 5 | IDList= 6 | HotKey=0 7 | -------------------------------------------------------------------------------- /src/main/resources/static/user/layer.mobile-v2.0/doc/官网.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://layer.layui.com/ 5 | IDList= 6 | HotKey=0 7 | -------------------------------------------------------------------------------- /src/main/resources/static/user/layer.mobile-v2.0/doc/有问必答.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://fly.layui.com/ 5 | IDList= 6 | HotKey=0 7 | -------------------------------------------------------------------------------- /src/main/resources/static/user/layer.mobile-v2.0/layer_mobile/layer.js: -------------------------------------------------------------------------------- 1 | /*! layer mobile-v2.0 弹层组件移动版 License LGPL http://layer.layui.com/mobile By 贤心 */ 2 | ;!function(a){"use strict";var b=document,c="querySelectorAll",d="getElementsByClassName",e=function(a){return b[c](a)},f={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},g={extend:function(a){var b=JSON.parse(JSON.stringify(f));for(var c in a)b[c]=a[c];return b},timer:{},end:{}};g.touch=function(a,b){a.addEventListener("click",function(a){b.call(this,a)},!1)};var h=0,i=["layui-m-layer"],j=function(a){var b=this;b.config=g.extend(a),b.view()};j.prototype.view=function(){var a=this,c=a.config,f=b.createElement("div");a.id=f.id=i[0]+h,f.setAttribute("class",i[0]+" "+i[0]+(c.type||0)),f.setAttribute("index",h);var g=function(){var a="object"==typeof c.title;return c.title?'

'+(a?c.title[0]:c.title)+"

":""}(),j=function(){"string"==typeof c.btn&&(c.btn=[c.btn]);var a,b=(c.btn||[]).length;return 0!==b&&c.btn?(a=''+c.btn[0]+"",2===b&&(a=''+c.btn[1]+""+a),'
'+a+"
"):""}();if(c.fixed||(c.top=c.hasOwnProperty("top")?c.top:100,c.style=c.style||"",c.style+=" top:"+(b.body.scrollTop+c.top)+"px"),2===c.type&&(c.content='

'+(c.content||"")+"

"),c.skin&&(c.anim="up"),"msg"===c.skin&&(c.shade=!1),f.innerHTML=(c.shade?"
':"")+'
"+g+'
'+c.content+"
"+j+"
",!c.type||2===c.type){var k=b[d](i[0]+c.type),l=k.length;l>=1&&layer.close(k[0].getAttribute("index"))}document.body.appendChild(f);var m=a.elem=e("#"+a.id)[0];c.success&&c.success(m),a.index=h++,a.action(c,m)},j.prototype.action=function(a,b){var c=this;a.time&&(g.timer[c.index]=setTimeout(function(){layer.close(c.index)},1e3*a.time));var e=function(){var b=this.getAttribute("type");0==b?(a.no&&a.no(),layer.close(c.index)):a.yes?a.yes(c.index):layer.close(c.index)};if(a.btn)for(var f=b[d]("layui-m-layerbtn")[0].children,h=f.length,i=0;h>i;i++)g.touch(f[i],e);if(a.shade&&a.shadeClose){var j=b[d]("layui-m-layershade")[0];g.touch(j,function(){layer.close(c.index,a.end)})}a.end&&(g.end[c.index]=a.end)},a.layer={v:"2.0",index:h,open:function(a){var b=new j(a||{});return b.index},close:function(a){var c=e("#"+i[0]+a)[0];c&&(c.innerHTML="",b.body.removeChild(c),clearTimeout(g.timer[a]),delete g.timer[a],"function"==typeof g.end[a]&&g.end[a](),delete g.end[a])},closeAll:function(){for(var a=b[d](i[0]),c=0,e=a.length;e>c;c++)layer.close(0|a[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var a=document.scripts,c=a[a.length-1],d=c.src,e=d.substring(0,d.lastIndexOf("/")+1);c.getAttribute("merge")||document.head.appendChild(function(){var a=b.createElement("link");return a.href=e+"need/layer.css?2.0",a.type="text/css",a.rel="styleSheet",a.id="layermcss",a}())}()}(window); -------------------------------------------------------------------------------- /src/main/resources/static/user/layer.mobile-v2.0/layim.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://layim.layui.com/ 5 | IDList= 6 | HotKey=0 7 | -------------------------------------------------------------------------------- /src/main/resources/static/user/layer.mobile-v2.0/更新日志.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GGsnake/ShopMall/607c4d85778df12b76363be8aaec246a4dec0cb7/src/main/resources/static/user/layer.mobile-v2.0/更新日志.txt -------------------------------------------------------------------------------- /src/main/resources/static/user/shop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 57 | 58 | 59 | 60 | 91 | 92 | 93 | 94 |
95 |
96 |
97 |
一键复制>进入购物app
98 |
99 | 100 |
101 |
102 | 103 |
104 | 105 | 106 | -------------------------------------------------------------------------------- /src/main/resources/static/user/zhuche_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GGsnake/ShopMall/607c4d85778df12b76363be8aaec246a4dec0cb7/src/main/resources/static/user/zhuche_bg@2x.png -------------------------------------------------------------------------------- /src/test/java/com/superman/superman/MemberServiceTest.java: -------------------------------------------------------------------------------- 1 | //package com.superman.superman; 2 | // 3 | //import com.superman.superman.service.MemberService; 4 | //import com.superman.superman.service.OderService; 5 | //import com.superman.superman.utils.EveryUtils; 6 | //import lombok.extern.java.Log; 7 | //import org.junit.Test; 8 | //import org.junit.runner.RunWith; 9 | //import org.springframework.beans.factory.annotation.Autowired; 10 | //import org.springframework.boot.test.context.SpringBootTest; 11 | //import org.springframework.test.context.junit4.SpringRunner; 12 | // 13 | //import java.util.HashSet; 14 | // 15 | //@Log 16 | //@RunWith(SpringRunner.class) 17 | //@SpringBootTest 18 | //public class MemberServiceTest { 19 | // @Autowired 20 | // MemberService memberService; 21 | // @Autowired 22 | // OderService oderService; 23 | // @Test 24 | // public void getMyMoney(){ 25 | // HashSet uidSet = new HashSet<>(); 26 | // uidSet.add(65l); 27 | // Long aLong = oderService.superQueryOderForUidList(EveryUtils.setToList(uidSet), 1); 28 | // log.warning(aLong.toString()); 29 | // } 30 | //} 31 | -------------------------------------------------------------------------------- /src/test/java/com/superman/superman/NoteTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GGsnake/ShopMall/607c4d85778df12b76363be8aaec246a4dec0cb7/src/test/java/com/superman/superman/NoteTest.java -------------------------------------------------------------------------------- /src/test/java/com/superman/superman/ScoreTest.java: -------------------------------------------------------------------------------- 1 | //package com.superman.superman; 2 | // 3 | //import com.superman.superman.service.ScoreService; 4 | //import com.superman.superman.utils.SmsSendDemo; 5 | //import com.superman.superman.utils.sms.SmsSendResponse; 6 | //import lombok.extern.java.Log; 7 | //import org.junit.Test; 8 | //import org.junit.runner.RunWith; 9 | //import org.springframework.beans.factory.annotation.Autowired; 10 | //import org.springframework.boot.test.context.SpringBootTest; 11 | //import org.springframework.test.context.junit4.SpringRunner; 12 | // 13 | //@Log 14 | //@RunWith(SpringRunner.class) 15 | //@SpringBootTest 16 | //public class ScoreTest { 17 | // @Autowired 18 | // ScoreService scoreService; 19 | // @Test 20 | // public void cash(){ 21 | // Boolean aBoolean = scoreService.scoreToCash(Long.valueOf(38)); 22 | // log.warning(aBoolean.toString()); 23 | // } 24 | // @Test 25 | // public void phone(){ 26 | // SmsSendResponse sms = SmsSendDemo.getSms("13692939345","666663"); 27 | // log.warning(sms.toString()); 28 | // } 29 | //} 30 | -------------------------------------------------------------------------------- /src/test/java/com/superman/superman/maven: -------------------------------------------------------------------------------- 1 | mvn install:install-file -Dfile=D:\taobaosdk.jar -DgroupId=com.taobaosdk -DartifactId=taobaosdk -Dversion=1.0.0 -Dpackaging=jar 2 | 3 | --------------------------------------------------------------------------------