| @@ -11,13 +11,18 @@ | |||
| * 系统端代码 | |||
| * fumao-service | |||
| * controller里面调用, 聚合其他几个模块的代码 | |||
| * fumao-bi | |||
| * 统计数据 | |||
| ## jpa相关 | |||
| ### 快速查询 | |||
| ``` | |||
| 单表条件查询 | |||
| @QueryItem(type = QueryType.Eq) 等等 | |||
| 用于快速开发查询接口 | |||
| 多表条件查询 | |||
| @QueryItem(join = QueryJoinType.Inner, type = QueryType.equal, column = "实体里面的属性.表属性"> | |||
| QueryBuilder.build(条件对象) 返回 Predicate 可交给SpringData 查询 | |||
| ``` | |||
| @@ -50,8 +55,26 @@ QueryBuilder.build(条件对象) 返回 Predicate 可交给SpringData 查询 | |||
| * 动态角色实现 AccessDecisionManager 接口 | |||
| ## 集团实例 | |||
| ## 集团实例, 基于flyway | |||
| ``` | |||
| 新建集团的时候会手动跑Flyway方法, 创建一个新实例 | |||
| ``` | |||
| 目前策略 | |||
| 主库 | |||
| 系统数据 | |||
| 集团数据 | |||
| 集团库 | |||
| 集团数据 | |||
| 业务数据 | |||
| ``` | |||
| * DBRouteFilter | |||
| * 从请求上下文自动企切库 | |||
| * 集团端和业务端从JWT中抽取库 | |||
| * C端和B端, 从URL中收取库 | |||
| * DynamicDataSource | |||
| * 扩展DataSource, 可以自动切库 | |||
| * DBConfiguration | |||
| * 初始化主库 | |||
| * CompanyConfiguration | |||
| * 初始化集团库 | |||
| @@ -4,7 +4,7 @@ | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <artifactId>fumao</artifactId> | |||
| <groupId>com.aki</groupId> | |||
| <groupId>com.chilunyc</groupId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| @@ -32,9 +32,14 @@ | |||
| <!--<artifactId>spring-boot-starter-websocket</artifactId>--> | |||
| <!--</dependency>--> | |||
| <dependency> | |||
| <groupId>com.amazonaws</groupId> | |||
| <artifactId>aws-java-sdk-s3</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.aki</groupId> | |||
| <groupId>com.chilunyc</groupId> | |||
| <artifactId>fumao-service</artifactId> | |||
| <version>${project.version}</version> | |||
| </dependency> | |||
| @@ -4,6 +4,7 @@ import com.chilunyc.fumao.common.config.ApplicationProperty; | |||
| import com.chilunyc.fumao.config.bean.MultiBeanNameGenerator; | |||
| import com.alibaba.fastjson.parser.ParserConfig; | |||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
| import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; | |||
| import org.springframework.boot.builder.SpringApplicationBuilder; | |||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | |||
| import org.springframework.boot.system.ApplicationPidFileWriter; | |||
| @@ -20,7 +21,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; | |||
| /** | |||
| * | |||
| */ | |||
| @SpringBootApplication() | |||
| @SpringBootApplication( | |||
| exclude = {FlywayAutoConfiguration.class} | |||
| ) | |||
| @EnableAsync | |||
| @EnableScheduling | |||
| @EnableJpaRepositories | |||
| @@ -62,7 +62,7 @@ class PlaceAdminController { | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(CompanyAdmin companyAdmin, @RequestBody @Valid PlaceAdminEditRequest request) { | |||
| request.setPlaceAdminType(PlaceAdminType.Manager); | |||
| request.setType(PlaceAdminType.Manager); | |||
| request.setCompanyId(companyAdmin.getCompanyId()); | |||
| placeAdminService.edit(request); | |||
| return JsonResponse.success(); | |||
| @@ -0,0 +1,57 @@ | |||
| package com.chilunyc.fumao.api.customer; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.place.model.Coupon; | |||
| import com.chilunyc.fumao.place.request.coupon.CouponPageRequest; | |||
| import com.chilunyc.fumao.place.service.CouponService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "优惠券") | |||
| @RestController | |||
| @RequestMapping("/customer/{cid}/coupon") | |||
| class CouponController { | |||
| @Autowired | |||
| CouponService couponService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Coupon>> page(@RequestBody CouponPageRequest request) { | |||
| Page<Coupon> page = couponService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Coupon> info(@PathVariable Long id) { | |||
| Coupon couponResponse = couponService.find(id); | |||
| return JsonResponse.success(couponResponse); | |||
| } | |||
| @ApiOperation(value = "所有") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/all", method = RequestMethod.POST) | |||
| JsonResponse<List<Coupon>> all() { | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| package com.chilunyc.fumao.api.customer; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.Customer; | |||
| import com.chilunyc.fumao.place.request.customer.CustomerEditRequest; | |||
| import com.chilunyc.fumao.place.request.customer.CustomerPageRequest; | |||
| import com.chilunyc.fumao.place.service.CustomerService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "顾客") | |||
| @RestController | |||
| @RequestMapping("/customer/{cid}/customer") | |||
| class CustomerController { | |||
| @Autowired | |||
| CustomerService customerService; | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Customer> info(PlaceAdmin placeAdmin, @PathVariable Long id) { | |||
| Customer customerResponse = customerService.find(id); | |||
| return JsonResponse.success(customerResponse); | |||
| } | |||
| } | |||
| @@ -0,0 +1,43 @@ | |||
| package com.chilunyc.fumao.api.customer; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.company.model.Place; | |||
| import com.chilunyc.fumao.company.request.place.PlacePageRequest; | |||
| import com.chilunyc.fumao.company.service.PlaceService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商场") | |||
| @RestController | |||
| @RequestMapping("/customer/{cid}/place") | |||
| class PlaceController { | |||
| @Autowired | |||
| PlaceService placeService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Place>> page(@RequestBody PlacePageRequest request) { | |||
| Page<Place> page = placeService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| } | |||
| @@ -0,0 +1,49 @@ | |||
| package com.chilunyc.fumao.api.customer; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.place.model.Shop; | |||
| import com.chilunyc.fumao.place.request.shop.ShopPageRequest; | |||
| import com.chilunyc.fumao.place.service.ShopService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商铺") | |||
| @RestController | |||
| @RequestMapping("/customer/{cid}/shop") | |||
| class ShopController { | |||
| @Autowired | |||
| ShopService shopService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Shop>> page(@RequestBody ShopPageRequest request) { | |||
| Page<Shop> page = shopService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Shop> info(@PathVariable Long id) { | |||
| Shop shopResponse = shopService.find(id); | |||
| return JsonResponse.success(shopResponse); | |||
| } | |||
| } | |||
| @@ -0,0 +1,61 @@ | |||
| package com.chilunyc.fumao.api.customer; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.place.model.Trade; | |||
| import com.chilunyc.fumao.place.request.trade.TradeEditRequest; | |||
| import com.chilunyc.fumao.place.request.trade.TradePageRequest; | |||
| import com.chilunyc.fumao.place.service.TradeService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "订单") | |||
| @RestController | |||
| @RequestMapping("/customer/{cid}/trade") | |||
| class TradeController { | |||
| @Autowired | |||
| TradeService tradeService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Trade>> page(@RequestBody TradePageRequest request) { | |||
| Page<Trade> page = tradeService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Trade> info(@PathVariable Long id) { | |||
| Trade tradeResponse = tradeService.find(id); | |||
| return JsonResponse.success(tradeResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "Trade") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(@RequestBody @Valid TradeEditRequest request) { | |||
| tradeService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,57 @@ | |||
| package com.chilunyc.fumao.api.merchant; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.place.model.Coupon; | |||
| import com.chilunyc.fumao.place.request.coupon.CouponPageRequest; | |||
| import com.chilunyc.fumao.place.service.CouponService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "优惠券") | |||
| @RestController | |||
| @RequestMapping("/merchant/{cid}/coupon") | |||
| class CouponController { | |||
| @Autowired | |||
| CouponService couponService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Coupon>> page(@RequestBody CouponPageRequest request) { | |||
| Page<Coupon> page = couponService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Coupon> info(@PathVariable Long id) { | |||
| Coupon couponResponse = couponService.find(id); | |||
| return JsonResponse.success(couponResponse); | |||
| } | |||
| @ApiOperation(value = "所有") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/all", method = RequestMethod.POST) | |||
| JsonResponse<List<Coupon>> all() { | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,62 @@ | |||
| package com.chilunyc.fumao.api.merchant; | |||
| import com.chilunyc.fumao.common.request.ChangePwdRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.sms.model.SmsType; | |||
| import com.chilunyc.fumao.common.sms.request.SmsSendRequest; | |||
| import com.chilunyc.fumao.common.sms.service.SmsService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.apache.commons.lang3.RandomStringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "找回密码") | |||
| @RestController | |||
| @RequestMapping("/merchant/find/pwd") | |||
| class FindPwdController { | |||
| @Autowired | |||
| SmsService smsService; | |||
| @ApiOperation(value = "改密码") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "UserChangePwdRequest") | |||
| }) | |||
| @RequestMapping(value = "/", method = RequestMethod.POST) | |||
| JsonResponse login(@RequestBody @Valid ChangePwdRequest request) { | |||
| // | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "改密码发短信") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "SmsSendRequest") | |||
| }) | |||
| @RequestMapping(value = "/send", method = RequestMethod.POST) | |||
| JsonResponse login(@RequestBody @Valid SmsSendRequest request) { | |||
| //1. 校验是否存在 | |||
| // if (!userService.isExist(request.getMobile())) { | |||
| // throw new SystemException("000010"); | |||
| // } | |||
| //2. 发送 | |||
| request.setContent(RandomStringUtils.randomNumeric(4)); | |||
| request.setType(SmsType.CustomerFindPwd); | |||
| smsService.send(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,52 @@ | |||
| package com.chilunyc.fumao.api.merchant; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.place.model.Trade; | |||
| import com.chilunyc.fumao.place.request.trade.TradeEditRequest; | |||
| import com.chilunyc.fumao.place.request.trade.TradePageRequest; | |||
| import com.chilunyc.fumao.place.service.TradeService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "订单") | |||
| @RestController | |||
| @RequestMapping("/merchant/{cid}/trade") | |||
| class TradeController { | |||
| @Autowired | |||
| TradeService tradeService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Trade>> page(@RequestBody TradePageRequest request) { | |||
| Page<Trade> page = tradeService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Trade> info(@PathVariable Long id) { | |||
| Trade tradeResponse = tradeService.find(id); | |||
| return JsonResponse.success(tradeResponse); | |||
| } | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.bi.model.ClientPv; | |||
| import com.chilunyc.fumao.bi.request.clientPv.ClientPvPageRequest; | |||
| import com.chilunyc.fumao.bi.service.ClientPvService; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "C端数据") | |||
| @RestController | |||
| @RequestMapping("/place/client/pv") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceDataExp) | |||
| class ClientPvController { | |||
| @Autowired | |||
| ClientPvService clientPvService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<ClientPv>> page(@RequestBody ClientPvPageRequest request) { | |||
| Page<ClientPv> page = clientPvService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| } | |||
| @@ -0,0 +1,76 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.CouponChannel; | |||
| import com.chilunyc.fumao.place.request.couponChannel.CouponChannelEditRequest; | |||
| import com.chilunyc.fumao.place.request.couponChannel.CouponChannelPageRequest; | |||
| import com.chilunyc.fumao.place.service.CouponChannelService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "优惠券渠道") | |||
| @RestController | |||
| @RequestMapping("/place/coupon/channel") | |||
| class CouponChannelController { | |||
| @Autowired | |||
| CouponChannelService couponChannelService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<CouponChannel>> page(@RequestBody CouponChannelPageRequest request) { | |||
| Page<CouponChannel> page = couponChannelService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<CouponChannel> info(@PathVariable Long id) { | |||
| CouponChannel couponChannelResponse = couponChannelService.find(id); | |||
| return JsonResponse.success(couponChannelResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "CouponChannel") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(PlaceAdmin placeAdmin, @RequestBody @Valid CouponChannelEditRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| couponChannelService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(@RequestBody @Valid IdsRequest request) { | |||
| couponChannelService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,98 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.common.util.MapBuilder; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.Coupon; | |||
| import com.chilunyc.fumao.place.model.CouponChannel; | |||
| import com.chilunyc.fumao.place.request.coupon.CouponEditRequest; | |||
| import com.chilunyc.fumao.place.request.coupon.CouponPageRequest; | |||
| import com.chilunyc.fumao.place.service.CouponChannelService; | |||
| import com.chilunyc.fumao.place.service.CouponService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "优惠券") | |||
| @RestController | |||
| @RequestMapping("/place/coupon") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceCouponExp) | |||
| class CouponController { | |||
| @Autowired | |||
| CouponService couponService; | |||
| @Autowired | |||
| CouponChannelService couponChannelService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Coupon>> page(PlaceAdmin placeAdmin, @RequestBody CouponPageRequest request) { | |||
| Page<Coupon> page = couponService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Map> info(@PathVariable Long id) { | |||
| Coupon couponResponse = couponService.find(id); | |||
| List<CouponChannel> couponChannelList = couponChannelService.findByCouponId(id, true); | |||
| return JsonResponse.success( | |||
| MapBuilder | |||
| .builder() | |||
| .put("coupon", couponResponse) | |||
| .put("couponCateList", couponChannelList) | |||
| .getMap() | |||
| ); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "Coupon") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(PlaceAdmin placeAdmin, @RequestBody @Valid CouponEditRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| Coupon coupon = couponService.edit(request); | |||
| return JsonResponse.success(coupon); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(@RequestBody @Valid IdsRequest<Long> request) { | |||
| couponService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @RequestMapping(value = "/cate", method = RequestMethod.GET) | |||
| JsonResponse cates() { | |||
| return JsonResponse.success(couponService.cates()); | |||
| } | |||
| } | |||
| @@ -0,0 +1,43 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.bi.model.CouponPv; | |||
| import com.chilunyc.fumao.bi.request.couponPv.CouponPvPageRequest; | |||
| import com.chilunyc.fumao.bi.service.CouponPvService; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "优惠券数据") | |||
| @RestController | |||
| @RequestMapping("/place/coupon/pv") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceDataExp) | |||
| class CouponPvController { | |||
| @Autowired | |||
| CouponPvService couponPvService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<CouponPv>> page(@RequestBody CouponPvPageRequest request) { | |||
| Page<CouponPv> page = couponPvService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| } | |||
| @@ -0,0 +1,80 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.Customer; | |||
| import com.chilunyc.fumao.place.request.customer.CustomerEditRequest; | |||
| import com.chilunyc.fumao.place.request.customer.CustomerPageRequest; | |||
| import com.chilunyc.fumao.place.service.CustomerService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "顾客") | |||
| @RestController | |||
| @RequestMapping("/place/customer") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceCustomerExp) | |||
| class CustomerController { | |||
| @Autowired | |||
| CustomerService customerService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Customer>> page(PlaceAdmin placeAdmin, @RequestBody CustomerPageRequest request) { | |||
| Page<Customer> page = customerService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Customer> info(PlaceAdmin placeAdmin, @PathVariable Long id) { | |||
| Customer customerResponse = customerService.find(id); | |||
| return JsonResponse.success(customerResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "Customer") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(PlaceAdmin placeAdmin, @RequestBody @Valid CustomerEditRequest request) { | |||
| customerService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(PlaceAdmin placeAdmin, @RequestBody @Valid IdsRequest<Long> request) { | |||
| customerService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @RequestMapping(value = "/find/mobile/{mobile}") | |||
| JsonResponse findByMobile(@PathVariable String mobile) { | |||
| return JsonResponse.success(customerService.findByMobile(mobile)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,80 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.bi.model.BiCustomerRegister; | |||
| import com.chilunyc.fumao.bi.model.BiTrade; | |||
| import com.chilunyc.fumao.bi.service.BiCustomerLoginService; | |||
| import com.chilunyc.fumao.bi.service.BiCustomerRegisterService; | |||
| import com.chilunyc.fumao.bi.service.BiTradeService; | |||
| import com.chilunyc.fumao.common.request.TimeRangeRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.response.KeyValue; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.service.service.CustomerDashboardService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "顾客") | |||
| @RestController | |||
| @RequestMapping("/place/customer/dashboard") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceCustomerExp) | |||
| class CustomerDashboardController { | |||
| @Autowired | |||
| CustomerDashboardService customerDashboardService; | |||
| @Autowired | |||
| BiCustomerRegisterService biCustomerRegisterService; | |||
| @Autowired | |||
| BiCustomerLoginService biCustomerLoginService; | |||
| @Autowired | |||
| BiTradeService biTradeService; | |||
| @ApiOperation("今日新增会员") | |||
| @RequestMapping(value = "/add", method = RequestMethod.GET) | |||
| JsonResponse add() { | |||
| return JsonResponse.success(customerDashboardService.add()); | |||
| } | |||
| @ApiOperation("今日会员消费金额") | |||
| @RequestMapping(value = "/money", method = RequestMethod.GET) | |||
| JsonResponse money() { | |||
| return JsonResponse.success(customerDashboardService.money()); | |||
| } | |||
| @RequestMapping(value = "/chart/register", method = RequestMethod.POST) | |||
| JsonResponse<List<BiCustomerRegister>> chartRegister(@RequestBody TimeRangeRequest request) { | |||
| return JsonResponse.success( | |||
| biCustomerRegisterService.range(request.getTimeRange()) | |||
| ); | |||
| } | |||
| @RequestMapping(value = "/chart/active", method = RequestMethod.POST) | |||
| JsonResponse<List<KeyValue>> chartActive(@RequestBody TimeRangeRequest request) { | |||
| return JsonResponse.success( | |||
| biCustomerLoginService.range(request.getTimeRange()) | |||
| ); | |||
| } | |||
| @RequestMapping(value = "/chart/trade", method = RequestMethod.POST) | |||
| JsonResponse<List<BiTrade>> chartTrade(@RequestBody TimeRangeRequest request) { | |||
| return JsonResponse.success( | |||
| biTradeService.range(request.getTimeRange()) | |||
| ); | |||
| } | |||
| } | |||
| @@ -0,0 +1,52 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.LoginRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.util.jwt.JwtUtils; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.company.service.PlaceAdminService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "登录登出") | |||
| @RestController | |||
| @RequestMapping("/place") | |||
| class LoginLogoutController { | |||
| @Autowired | |||
| PlaceAdminService placeAdminService; | |||
| @ApiOperation(value = "登录") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "LoginRequest") | |||
| }) | |||
| @RequestMapping(value = "/login", method = RequestMethod.POST) | |||
| JsonResponse login(@RequestBody @Valid LoginRequest request) { | |||
| PlaceAdmin login = placeAdminService.login(request); | |||
| return JsonResponse.success( | |||
| JwtUtils.encode(JwtUtils.T.Market, login) | |||
| ); | |||
| } | |||
| @ApiOperation(value = "登出") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/logout", method = RequestMethod.GET) | |||
| JsonResponse logout() { | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,92 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.MerchantAdmin; | |||
| import com.chilunyc.fumao.place.request.merchantAdmin.MerchantAdminEditRequest; | |||
| import com.chilunyc.fumao.place.request.merchantAdmin.MerchantAdminPageRequest; | |||
| import com.chilunyc.fumao.place.service.MerchantAdminService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商户管理员") | |||
| @RestController | |||
| @RequestMapping("/place/merchant/admin") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceMerchantExp) | |||
| class MerchantAdminController { | |||
| @Autowired | |||
| MerchantAdminService merchantAdminService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<MerchantAdmin>> page(@RequestBody MerchantAdminPageRequest request) { | |||
| Page<MerchantAdmin> page = merchantAdminService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<MerchantAdmin> info(@PathVariable Long id) { | |||
| MerchantAdmin merchantAdminResponse = merchantAdminService.find(id); | |||
| return JsonResponse.success(merchantAdminResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "MerchantAdmin") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(@RequestBody @Valid MerchantAdminEditRequest request) { | |||
| merchantAdminService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(@RequestBody @Valid IdsRequest<Long> request) { | |||
| merchantAdminService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @RequestMapping(value = "/find/all", method = RequestMethod.GET) | |||
| JsonResponse<List<MerchantAdmin>> all(MerchantAdminPageRequest request) { | |||
| return JsonResponse.success(merchantAdminService.all(request)); | |||
| } | |||
| @ApiOperation(value = "重置密码") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/reset/password/{id}", method = RequestMethod.GET) | |||
| JsonResponse resetPassword(PlaceAdmin placeAdmin, @PathVariable Long id) { | |||
| merchantAdminService.resetPassword(id); | |||
| log.info(String.format("商场管理员[ %s ]重置密码 => [ %s ]", placeAdmin.getId(), id)); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,79 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.place.model.Merchant; | |||
| import com.chilunyc.fumao.place.request.merchant.MerchantEditRequest; | |||
| import com.chilunyc.fumao.place.request.merchant.MerchantPageRequest; | |||
| import com.chilunyc.fumao.place.service.MerchantService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商户") | |||
| @RestController | |||
| @RequestMapping("/place/merchant") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceMerchantExp) | |||
| class MerchantController { | |||
| @Autowired | |||
| MerchantService merchantService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Merchant>> page(@RequestBody MerchantPageRequest request) { | |||
| Page<Merchant> page = merchantService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Merchant> info(@PathVariable Long id) { | |||
| Merchant merchantResponse = merchantService.find(id); | |||
| return JsonResponse.success(merchantResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "Merchant") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(@RequestBody @Valid MerchantEditRequest request) { | |||
| Merchant edit = merchantService.edit(request); | |||
| return JsonResponse.success(edit); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(@RequestBody @Valid IdsRequest<Long> request) { | |||
| merchantService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,110 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.company.request.placeAdmin.PlaceAdminAddRequest; | |||
| import com.chilunyc.fumao.company.request.placeAdmin.PlaceAdminEditRequest; | |||
| import com.chilunyc.fumao.company.request.placeAdmin.PlaceAdminPageRequest; | |||
| import com.chilunyc.fumao.company.service.PlaceAdminService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商场管理员") | |||
| @RestController | |||
| @RequestMapping("/place/admin") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceAccountExp) | |||
| class PlaceAdminController { | |||
| @Autowired | |||
| PlaceAdminService placeAdminService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<PlaceAdmin>> page(PlaceAdmin placeAdmin, @RequestBody PlaceAdminPageRequest request) { | |||
| request.setCompanyId(placeAdmin.getPlaceId()); | |||
| Page<PlaceAdmin> page = placeAdminService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<PlaceAdmin> info(@PathVariable Long id) { | |||
| PlaceAdmin placeAdminResponse = placeAdminService.find(id); | |||
| return JsonResponse.success(placeAdminResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PlaceAdmin") | |||
| }) | |||
| @RequestMapping(value = "/add", method = RequestMethod.POST) | |||
| JsonResponse add(PlaceAdmin placeAdmin, @RequestBody @Valid PlaceAdminAddRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| request.setCompanyId(placeAdmin.getCompanyId()); | |||
| PlaceAdmin add = placeAdminService.add(request); | |||
| return JsonResponse.success(add); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PlaceAdmin") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(PlaceAdmin placeAdmin, @RequestBody @Valid PlaceAdminEditRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| request.setCompanyId(placeAdmin.getCompanyId()); | |||
| placeAdminService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(@RequestBody @Valid IdsRequest<Long> request) { | |||
| placeAdminService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "重置密码") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/reset/password/{id}", method = RequestMethod.GET) | |||
| JsonResponse resetPassword(PlaceAdmin companyAdmin, @PathVariable Long id) { | |||
| placeAdminService.resetPassword(id, companyAdmin.getCompanyId()); | |||
| log.info(String.format("商场管理员[ %s ]重置密码 => [ %s ]", companyAdmin.getId(), id)); | |||
| return JsonResponse.success(); | |||
| } | |||
| @RequestMapping(value = "/find/all", method = RequestMethod.POST) | |||
| JsonResponse<List<PlaceAdmin>> all(PlaceAdmin placeAdmin, @RequestBody PlaceAdminPageRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| return JsonResponse.success(placeAdminService.all(request)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,49 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.response.NodeResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.company.model.PlaceFloor; | |||
| import com.chilunyc.fumao.company.request.placeFloor.PlaceFloorPageRequest; | |||
| import com.chilunyc.fumao.company.service.PlaceFloorService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商场楼层") | |||
| @RestController | |||
| @RequestMapping("/place/floor") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceMerchantExp) | |||
| class PlaceFloorController { | |||
| @Autowired | |||
| PlaceFloorService placeFloorService; | |||
| @ApiOperation(value = "所有") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find/group", method = RequestMethod.GET) | |||
| JsonResponse< List<NodeResponse>> group(PlaceAdmin placeAdmin, PlaceFloorPageRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| return JsonResponse.success(placeFloorService.group(request)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.PlaceSetting; | |||
| import com.chilunyc.fumao.place.model.enums.PlaceSettingType; | |||
| import com.chilunyc.fumao.place.request.placeSetting.PlaceSettingEditRequest; | |||
| import com.chilunyc.fumao.place.service.PlaceSettingService; | |||
| import io.swagger.annotations.Api; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商场配置") | |||
| @RestController | |||
| @RequestMapping("/place/setting") | |||
| class PlaceSettingController { | |||
| @Autowired | |||
| PlaceSettingService placeSettingService; | |||
| @RequestMapping(value = "/get/{type}", method = RequestMethod.GET) | |||
| JsonResponse<String> get(PlaceAdmin placeAdmin, @PathVariable PlaceSettingType type) { | |||
| PlaceSetting placeSetting = placeSettingService.get(placeAdmin.getPlaceId(), type); | |||
| return JsonResponse.success(placeSetting == null ? null : placeSetting.getValue()); | |||
| } | |||
| @RequestMapping(value = "/set", method = RequestMethod.POST) | |||
| JsonResponse set(PlaceAdmin placeAdmin, @RequestBody PlaceSettingEditRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| placeSettingService.set(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,69 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.PointTransaction; | |||
| import com.chilunyc.fumao.place.request.pointTransaction.PointTransactionPaddedRequest; | |||
| import com.chilunyc.fumao.place.request.pointTransaction.PointTransactionPageRequest; | |||
| import com.chilunyc.fumao.place.service.PointTransactionService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "积分") | |||
| @RestController | |||
| @RequestMapping("/place/point/transaction") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceCustomerExp) | |||
| class PointTransactionController { | |||
| @Autowired | |||
| PointTransactionService pointTransactionService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<PointTransaction>> page(@RequestBody PointTransactionPageRequest request) { | |||
| Page<PointTransaction> page = pointTransactionService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<PointTransaction> info(@PathVariable Long id) { | |||
| PointTransaction pointTransactionResponse = pointTransactionService.find(id); | |||
| return JsonResponse.success(pointTransactionResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PointTransaction") | |||
| }) | |||
| @RequestMapping(value = "/padded", method = RequestMethod.POST) | |||
| JsonResponse padded(PlaceAdmin placeAdmin, @RequestBody @Valid PointTransactionPaddedRequest request) { | |||
| request.setAdminId(placeAdmin.getId()); | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| pointTransactionService.padded(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.bi.model.ScenePv; | |||
| import com.chilunyc.fumao.bi.request.scenePv.ScenePvPageRequest; | |||
| import com.chilunyc.fumao.bi.service.ScenePvService; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "场景数据") | |||
| @RestController | |||
| @RequestMapping("/place/scene/pv") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceDataExp) | |||
| class ScenePvController { | |||
| @Autowired | |||
| ScenePvService scenePvService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<ScenePv>> page(@RequestBody ScenePvPageRequest request) { | |||
| Page<ScenePv> page = scenePvService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| } | |||
| @@ -0,0 +1,105 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.AssignsRequest; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.company.model.PlaceAdmin; | |||
| import com.chilunyc.fumao.place.model.Shop; | |||
| import com.chilunyc.fumao.place.request.shop.ShopEditRequest; | |||
| import com.chilunyc.fumao.place.request.shop.ShopPageRequest; | |||
| import com.chilunyc.fumao.place.service.ShopService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "商铺") | |||
| @RestController | |||
| @RequestMapping("/place/shop") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceMerchantExp) | |||
| class ShopController { | |||
| @Autowired | |||
| ShopService shopService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Shop>> page(PlaceAdmin placeAdmin, @RequestBody ShopPageRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| Page<Shop> page = shopService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Shop> info(@PathVariable Long id) { | |||
| Shop shopResponse = shopService.find(id); | |||
| return JsonResponse.success(shopResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "Shop") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(PlaceAdmin placeAdmin, @RequestBody @Valid ShopEditRequest request) { | |||
| request.setPlaceId(placeAdmin.getPlaceId()); | |||
| shopService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @RequestMapping(value = "/assign", method = RequestMethod.POST) | |||
| JsonResponse assignToMerchant(@RequestBody @Valid AssignsRequest<Long> request) { | |||
| shopService.assign(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(@RequestBody @Valid IdsRequest<Long> request) { | |||
| shopService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "所有") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/all", method = RequestMethod.GET) | |||
| JsonResponse<List<Shop>> all(ShopPageRequest request) { | |||
| List<Shop> result = shopService.all(request); | |||
| return JsonResponse.success(result); | |||
| } | |||
| @ApiOperation(value = "解绑商户") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/unbind/merchant/{shopId}", method = RequestMethod.GET) | |||
| JsonResponse unbindMerchant(@PathVariable Long shopId){ | |||
| shopService.unbindMerchant(shopId); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,77 @@ | |||
| package com.chilunyc.fumao.api.place; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import com.chilunyc.fumao.place.model.Trade; | |||
| import com.chilunyc.fumao.place.request.trade.TradeEditRequest; | |||
| import com.chilunyc.fumao.place.request.trade.TradePageRequest; | |||
| import com.chilunyc.fumao.place.service.TradeService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "订单") | |||
| @RestController | |||
| @RequestMapping("/place/trade") | |||
| @PreAuthorize(AuthRoles.PlaceAdminExp + " OR " + AuthRoles.PlaceCustomerExp) | |||
| class TradeController { | |||
| @Autowired | |||
| TradeService tradeService; | |||
| @ApiOperation(value = "分页") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "PageRequest") | |||
| }) | |||
| @RequestMapping(value = "/find", method = RequestMethod.POST) | |||
| JsonResponse<Page<Trade>> page(@RequestBody TradePageRequest request) { | |||
| Page<Trade> page = tradeService.page(request); | |||
| return JsonResponse.success(page); | |||
| } | |||
| @ApiOperation(value = "详情") | |||
| @ApiImplicitParams({ | |||
| }) | |||
| @RequestMapping(value = "/find/{id}", method = RequestMethod.GET) | |||
| JsonResponse<Trade> info(@PathVariable Long id) { | |||
| Trade tradeResponse = tradeService.find(id); | |||
| return JsonResponse.success(tradeResponse); | |||
| } | |||
| @ApiOperation(value = "新增 | 编辑") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "Trade") | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(@RequestBody @Valid TradeEditRequest request) { | |||
| tradeService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @ApiOperation(value = "删除") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "request", required = true, paramType = "body", dataType = "IdRequest") | |||
| }) | |||
| @RequestMapping(value = "/delete", method = RequestMethod.POST) | |||
| JsonResponse remove(@RequestBody @Valid IdsRequest request) { | |||
| tradeService.remove(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| } | |||
| @@ -60,7 +60,7 @@ class PlaceAdminController { | |||
| }) | |||
| @RequestMapping(value = "/edit", method = RequestMethod.POST) | |||
| JsonResponse edit(@RequestBody @Valid PlaceAdminEditRequest request) { | |||
| request.setPlaceAdminType(PlaceAdminType.Manager); | |||
| request.setType(PlaceAdminType.Manager); | |||
| placeAdminService.edit(request); | |||
| return JsonResponse.success(); | |||
| } | |||
| @@ -27,10 +27,31 @@ public class SwaggerConfig { | |||
| private TypeResolver typeResolver; | |||
| @Bean | |||
| Docket all() { | |||
| return build("所有", "/", "所有接口"); | |||
| Docket system() { | |||
| return build("系统端", "/system", "所有接口"); | |||
| } | |||
| @Bean | |||
| Docket customer() { | |||
| return build("C端", "/customer", "所有接口"); | |||
| } | |||
| @Bean | |||
| Docket merchant() { | |||
| return build("B端", "/merchant", "所有接口"); | |||
| } | |||
| @Bean | |||
| Docket place() { | |||
| return build("业务端", "/place", "所有接口"); | |||
| } | |||
| @Bean | |||
| Docket company() { | |||
| return build("集团段", "/place", "所有接口"); | |||
| } | |||
| /** | |||
| * @param group | |||
| * @param path | |||
| @@ -3,9 +3,11 @@ package com.chilunyc.fumao.config.web; | |||
| import com.chilunyc.fumao.common.config.ApplicationProperty; | |||
| import com.chilunyc.fumao.config.web.arguments.DateArgumentResolver; | |||
| import com.chilunyc.fumao.config.web.arguments.LoginUserArgumentResolver; | |||
| import com.chilunyc.fumao.config.web.interceptor.AuthInterceptor; | |||
| import com.chilunyc.fumao.config.web.filter.DBRouteFilter; | |||
| import com.chilunyc.fumao.config.web.interceptor.CorsInterceptor; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.boot.web.servlet.FilterRegistrationBean; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import org.springframework.web.method.support.HandlerMethodArgumentResolver; | |||
| import org.springframework.web.servlet.config.annotation.CorsRegistry; | |||
| @@ -20,9 +22,6 @@ import java.util.List; | |||
| @Configuration | |||
| public class WebConfig extends WebMvcConfigurerAdapter { | |||
| @Autowired | |||
| private AuthInterceptor authInterceptor; | |||
| @Autowired | |||
| private CorsInterceptor corsInterceptor; | |||
| @@ -32,6 +31,9 @@ public class WebConfig extends WebMvcConfigurerAdapter { | |||
| @Autowired | |||
| private ApplicationProperty applicationConfig; | |||
| @Autowired | |||
| private DBRouteFilter dbRouteFilter; | |||
| /** | |||
| * 跨域访问 | |||
| * | |||
| @@ -52,21 +54,6 @@ public class WebConfig extends WebMvcConfigurerAdapter { | |||
| @Override | |||
| public void addInterceptors(InterceptorRegistry registry) { | |||
| registry.addInterceptor(corsInterceptor); | |||
| // registry.addInterceptor(authInterceptor).excludePathPatterns( | |||
| // "/**/login", | |||
| // "/**/login/**", | |||
| // "/**/logout", | |||
| // "/upload", | |||
| // "/**/register/**", | |||
| // "/**/find/pwd/", | |||
| // "/**/find/pwd/**", | |||
| // "/swagger/**", | |||
| // "/swagger-resources/**", | |||
| // "/webjars/**", | |||
| // "/captcha", | |||
| // "/wx/**", | |||
| // "/error" | |||
| // ); | |||
| } | |||
| @Override | |||
| @@ -75,4 +62,12 @@ public class WebConfig extends WebMvcConfigurerAdapter { | |||
| argumentResolvers.add(new DateArgumentResolver()); | |||
| } | |||
| @Bean | |||
| FilterRegistrationBean dbRouteFilter() { | |||
| FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); | |||
| filterRegistrationBean.setFilter(dbRouteFilter); | |||
| filterRegistrationBean.addUrlPatterns("/*"); | |||
| filterRegistrationBean.setOrder(Integer.MAX_VALUE); //最后初始化, 依赖Jwt数值 | |||
| return filterRegistrationBean; | |||
| } | |||
| } | |||
| @@ -9,7 +9,7 @@ import org.springframework.security.config.http.SessionCreationPolicy; | |||
| import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; | |||
| /** | |||
| * Created by Tkk on 2018/7/23. | |||
| * on 2018/7/23. | |||
| */ | |||
| @Configuration | |||
| public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |||
| @@ -39,20 +39,22 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |||
| "/login/**", | |||
| "/**/login", | |||
| "/**/login/**") | |||
| .permitAll() | |||
| .permitAll() | |||
| // 放行通用 | |||
| .antMatchers( | |||
| "/common/**") | |||
| .permitAll() | |||
| .antMatchers("/common/**").permitAll() | |||
| // swagger | |||
| .antMatchers("/swagger-ui.html").permitAll() | |||
| .antMatchers("/swagger-resources/**").permitAll() | |||
| // 其他全部校验 | |||
| .anyRequest() | |||
| .authenticated() | |||
| .authenticated() | |||
| // 增加过滤器, 过滤权限 | |||
| .and() | |||
| .addFilterBefore(securityFilter, UsernamePasswordAuthenticationFilter.class); | |||
| } | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| package com.chilunyc.fumao.config.web.filter; | |||
| import com.chilunyc.fumao.common.context.Request; | |||
| import com.chilunyc.fumao.common.context.RequestHolder; | |||
| import com.chilunyc.fumao.common.db.datasource.DynamicDataSourceHolder; | |||
| import org.springframework.stereotype.Component; | |||
| import org.springframework.web.filter.OncePerRequestFilter; | |||
| import javax.servlet.FilterChain; | |||
| import javax.servlet.ServletException; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.IOException; | |||
| /** | |||
| * on 2018/7/26. | |||
| */ | |||
| @Component | |||
| public class DBRouteFilter extends OncePerRequestFilter { | |||
| @Override | |||
| protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { | |||
| try { | |||
| String servletPath = httpServletRequest.getServletPath(); | |||
| String prefix = org.apache.commons.lang3.StringUtils.substringBetween(servletPath, "/", "/"); | |||
| Request request = RequestHolder.get(); | |||
| if (request != null && request.getJwtValue() != null) { | |||
| Long cid = null; | |||
| switch (prefix) { | |||
| case "system": | |||
| break; | |||
| // 从jwt中获取 | |||
| case "company": | |||
| case "place": | |||
| cid = request.getJwtValue().get("cid", Long.class); | |||
| break; | |||
| // 从url中获取 | |||
| default: | |||
| cid = Long.parseLong(prefix); | |||
| break; | |||
| } | |||
| if (cid != null) { | |||
| DynamicDataSourceHolder.set(cid.toString()); | |||
| } | |||
| } | |||
| filterChain.doFilter(httpServletRequest, httpServletResponse); | |||
| } finally { | |||
| DynamicDataSourceHolder.remove(); | |||
| } | |||
| } | |||
| } | |||
| @@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletResponse; | |||
| import java.io.IOException; | |||
| /** | |||
| * Created by Tkk on 2018/7/23. | |||
| * on 2018/7/23. | |||
| */ | |||
| @Log4j | |||
| @Component | |||
| @@ -6,7 +6,6 @@ import com.chilunyc.fumao.common.exception.SystemException; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthUser; | |||
| import com.chilunyc.fumao.common.util.jwt.JwtUtils; | |||
| import com.chilunyc.fumao.config.web.arguments.LoginUserArgumentResolver; | |||
| import io.jsonwebtoken.Claims; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.apache.commons.lang.StringUtils; | |||
| @@ -32,7 +31,7 @@ import java.util.stream.Collectors; | |||
| /** | |||
| * 把JWT转换为security的对象 | |||
| * Created by Tkk on 2018/7/23. | |||
| * on 2018/7/23. | |||
| */ | |||
| @Component | |||
| @Log4j | |||
| @@ -49,6 +48,11 @@ public class SecurityFilter extends OncePerRequestFilter { | |||
| .request(httpServletRequest) | |||
| .build(); | |||
| String servletPath = httpServletRequest.getServletPath(); | |||
| if (isIgnore(servletPath)) { | |||
| filterChain.doFilter(httpServletRequest, httpServletResponse); | |||
| return; | |||
| } | |||
| String prefix = org.apache.commons.lang3.StringUtils.substringBetween(servletPath, "/", "/"); | |||
| switch (prefix) { | |||
| case "system": | |||
| @@ -108,6 +112,13 @@ public class SecurityFilter extends OncePerRequestFilter { | |||
| } | |||
| } | |||
| private boolean isIgnore(String servletPath) { | |||
| return servletPath.startsWith("/swagger") || | |||
| servletPath.startsWith("/webjar") || | |||
| servletPath.startsWith("/common"); | |||
| } | |||
| /** | |||
| * @param claims | |||
| * @return | |||
| @@ -0,0 +1,34 @@ | |||
| package com.chilunyc.fumao.controller.common; | |||
| import com.chilunyc.fumao.common.lbs.request.LBSPoiRequest; | |||
| import com.chilunyc.fumao.common.lbs.service.LBSService; | |||
| import com.chilunyc.fumao.common.response.JsonResponse; | |||
| import com.chilunyc.fumao.common.shiro.AuthRoles; | |||
| import io.swagger.annotations.Api; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestMethod; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import javax.validation.Valid; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Api(description = "登录登出") | |||
| @RestController | |||
| @RequestMapping("/common/lbs") | |||
| class LBSController { | |||
| @Autowired | |||
| LBSService lbsService; | |||
| @RequestMapping(value = "/poi/find", method = RequestMethod.POST) | |||
| JsonResponse login(@RequestBody @Valid LBSPoiRequest request) { | |||
| return JsonResponse.success(lbsService.findPoi(request)); | |||
| } | |||
| } | |||
| @@ -2,7 +2,7 @@ | |||
| ## | |||
| ###### | |||
| logging.level.root=INFO | |||
| logging.level.com.aki=INFO | |||
| logging.level.com.chilunyc=INFO | |||
| logging.level.org.springframework=INFO | |||
| logging.config=/opt/projects/config/logback.xml | |||
| @@ -57,7 +57,7 @@ spring.redis.pool.max-wait=-1 | |||
| ###### | |||
| ## \u6570\u636E\u6E90 | |||
| ###### | |||
| mybatis.mapper-locations=classpath*:com/aki/**/*Mapper.xml | |||
| mybatis.mapper-locations=classpath*:com/chilunyc/**/*Mapper.xml | |||
| mybatis.configuration.default-fetch-size=100 | |||
| mybatis.configuration.default-statement-timeout=30 | |||
| mybatis.configuration.map-underscore-to-camel-case=true | |||
| @@ -2,7 +2,7 @@ | |||
| ## | |||
| ###### | |||
| logging.level.root=INFO | |||
| logging.level.com.aki=TRACE | |||
| logging.level.com.chilunyc=TRACE | |||
| logging.level.org.springframework=INFO | |||
| logging.level.org.hibernate=INFO | |||
| @@ -46,14 +46,19 @@ pagehelper.helperDialect=mysql | |||
| pagehelper.reasonable=true | |||
| pagehelper.row-bounds-with-count=true | |||
| pagehelper.supportMethodsArguments=true | |||
| spring.jpa.hibernate.ddl-auto=update | |||
| #spring.jpa.hibernate.ddl-auto=update | |||
| spring.jpa.show-sql=true | |||
| spring.jpa.open-in-view=false | |||
| spring.datasource.testOnBorrow=true | |||
| spring.datasource.url=jdbc:mysql://127.0.0.1:3306/demo?characterEncoding=UTF-8&&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&connectTimeout=0 | |||
| #spring.datasource.url=jdbc:mysql://127.0.0.1:3306/demo?characterEncoding=UTF-8&&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&connectTimeout=0&useSSL=true | |||
| spring.datasource.username=root | |||
| spring.datasource.password= | |||
| db.host=127.0.0.1 | |||
| db.port=3306 | |||
| db.user=root | |||
| db.password= | |||
| db.pool=10 | |||
| #spring.datasource.testOnBorrow=true | |||
| #spring.datasource.url=jdbc:mysql://127.0.0.1:3306/demo?characterEncoding=UTF-8&&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&connectTimeout=0 | |||
| ##spring.datasource.url=jdbc:mysql://127.0.0.1:3306/demo?characterEncoding=UTF-8&&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&connectTimeout=0&useSSL=true | |||
| #spring.datasource.username=root | |||
| #spring.datasource.password= | |||
| ###### | |||
| ## redis | |||
| @@ -93,6 +98,18 @@ wechat.mp.aesKey= | |||
| wechat.mp.mch-id= | |||
| wechat.mp.mch-key= | |||
| wechat.mp.key-path= | |||
| ###### | |||
| ## \u5FAE\u4FE1 | |||
| ###### | |||
| wechat.ma.app-id=wx9d227fced4b94c12 | |||
| wechat.ma.secret=bc7ef9506b69fa5bc4249103e0c14ff6 | |||
| wechat.ma.token= | |||
| wechat.ma.aesKey= | |||
| wechat.ma.mch-id= | |||
| wechat.ma.mch-key= | |||
| wechat.ma.key-path= | |||
| ###### | |||
| ## \u767E\u5EA6 | |||
| ###### | |||
| @@ -0,0 +1,553 @@ | |||
| # ************************************************************ | |||
| # Sequel Pro SQL dump | |||
| # Version 4541 | |||
| # | |||
| # http://www.sequelpro.com/ | |||
| # https://github.com/sequelpro/sequelpro | |||
| # | |||
| # Host: 127.0.0.1 (MySQL 5.7.21) | |||
| # Database: f_system | |||
| # Generation Time: 2018-07-30 13:27:21 +0000 | |||
| # ************************************************************ | |||
| /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |||
| /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |||
| /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |||
| /*!40101 SET NAMES utf8 */; | |||
| /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | |||
| /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | |||
| /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | |||
| # Dump of table fumao_client_pv | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_client_pv`; | |||
| CREATE TABLE `fumao_client_pv` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `coupon_count` bigint(9) DEFAULT NULL COMMENT '领取量', | |||
| `coupon_customer_count` bigint(9) DEFAULT NULL COMMENT '领取人数', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `pv` bigint(9) DEFAULT NULL COMMENT 'pv', | |||
| `uv` bigint(9) DEFAULT NULL COMMENT 'uv', | |||
| `write_off_count` bigint(9) DEFAULT NULL COMMENT '核销量', | |||
| `write_off_customer_count` bigint(9) DEFAULT NULL COMMENT '核销人数', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_company | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_company`; | |||
| CREATE TABLE `fumao_company` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `address` varchar(64) DEFAULT NULL COMMENT '地址', | |||
| `area` varchar(10) DEFAULT NULL COMMENT '区域', | |||
| `city` varchar(10) DEFAULT NULL COMMENT '城市', | |||
| `create_time` datetime DEFAULT NULL, | |||
| `lat` varchar(12) DEFAULT NULL COMMENT '经度', | |||
| `lng` varchar(12) DEFAULT NULL COMMENT '纬度', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `poi` varchar(64) DEFAULT NULL COMMENT 'POI', | |||
| `province` varchar(10) DEFAULT NULL COMMENT '省份', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_company_admin | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_company_admin`; | |||
| CREATE TABLE `fumao_company_admin` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `company_id` varchar(64) DEFAULT NULL COMMENT '集团', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `password` varchar(32) DEFAULT NULL COMMENT '密码', | |||
| `salt` varchar(32) DEFAULT NULL COMMENT '盐值', | |||
| `origin_password` varchar(32) DEFAULT NULL COMMENT '初始密码', | |||
| PRIMARY KEY (`id`), | |||
| KEY `company_admin_mobile` (`mobile`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_company_apply | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_company_apply`; | |||
| CREATE TABLE `fumao_company_apply` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `market` text COMMENT '备注', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '集团名称', | |||
| `proposer` varchar(64) DEFAULT NULL COMMENT '申请人', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_coupon | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_coupon`; | |||
| CREATE TABLE `fumao_coupon` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `amount` double(9,2) DEFAULT NULL COMMENT '面额', | |||
| `cover` text COLLATE utf8mb4_unicode_ci COMMENT '封面', | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `description` text COLLATE utf8mb4_unicode_ci COMMENT '使用须知', | |||
| `kind` int(1) DEFAULT NULL COMMENT '类型', | |||
| `max_num` text COLLATE utf8mb4_unicode_ci COMMENT '限领', | |||
| `merchant_id` bigint(64) DEFAULT NULL COMMENT '商户', | |||
| `open_end` date DEFAULT NULL COMMENT '发放结束日期', | |||
| `open_from` date DEFAULT NULL COMMENT '发放开始日期', | |||
| `place_id` bigint(64) DEFAULT NULL COMMENT '商场', | |||
| `remain` int(9) DEFAULT NULL COMMENT '剩余库存', | |||
| `require_amount` double(9,2) DEFAULT NULL COMMENT '售价', | |||
| `send_way` int(1) DEFAULT NULL COMMENT '发劵方式', | |||
| `status` int(1) DEFAULT NULL COMMENT '状态', | |||
| `stock` int(9) DEFAULT NULL COMMENT '库存', | |||
| `sub_title` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '副标题', | |||
| `title` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称', | |||
| `valid_day` text COLLATE utf8mb4_unicode_ci COMMENT '有效日', | |||
| `valid_end` date DEFAULT NULL COMMENT '有效结束日期', | |||
| `valid_from` date DEFAULT NULL COMMENT '有效开始日期', | |||
| PRIMARY KEY (`id`), | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_coupon_pv | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_coupon_pv`; | |||
| CREATE TABLE `fumao_coupon_pv` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `coupon_count` bigint(9) DEFAULT NULL COMMENT '领取量', | |||
| `coupon_customer_count` bigint(9) DEFAULT NULL COMMENT '领取人数', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `pv` bigint(9) DEFAULT NULL COMMENT 'pv', | |||
| `uv` bigint(9) DEFAULT NULL COMMENT 'uv', | |||
| `write_off_count` bigint(9) DEFAULT NULL COMMENT '核销量', | |||
| `write_off_customer_count` bigint(9) DEFAULT NULL COMMENT '核销人数', | |||
| `coupon_kind` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '优惠券类型', | |||
| `coupon_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '优惠券名称', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_customer | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_customer`; | |||
| CREATE TABLE `fumao_customer` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `address` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '住址', | |||
| `birth` date DEFAULT NULL COMMENT '出生日期', | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `education` text COLLATE utf8mb4_unicode_ci COMMENT '学历', | |||
| `email` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮箱', | |||
| `mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称', | |||
| `score` int(9) DEFAULT NULL COMMENT '积分', | |||
| `sex` int(1) DEFAULT NULL COMMENT '性别', | |||
| `channel` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '注册渠道', | |||
| PRIMARY KEY (`id`), | |||
| KEY `customer_mobile` (`mobile`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_event_log | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_event_log`; | |||
| CREATE TABLE `fumao_event_log` ( | |||
| `id` bigint(20) NOT NULL AUTO_INCREMENT, | |||
| `content` longtext, | |||
| `create_time` datetime DEFAULT NULL, | |||
| `ip` varchar(255) DEFAULT NULL, | |||
| `operator` varchar(32) DEFAULT NULL, | |||
| `target` int(11) DEFAULT NULL, | |||
| `target_id` varchar(32) DEFAULT NULL, | |||
| `type` int(11) DEFAULT NULL, | |||
| PRIMARY KEY (`id`), | |||
| KEY `event_log_operator` (`operator`), | |||
| KEY `event_log_targetId` (`target_id`), | |||
| KEY `event_log_type` (`type`), | |||
| KEY `event_log_target` (`target`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_merchant | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_merchant`; | |||
| CREATE TABLE `fumao_merchant` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `image` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '图片', | |||
| `mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系方式', | |||
| `name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称', | |||
| PRIMARY KEY (`id`), | |||
| KEY `merchant_mobile` (`mobile`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_merchant_admin | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_merchant_admin`; | |||
| CREATE TABLE `fumao_merchant_admin` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `merchant_id` bigint(64) DEFAULT NULL COMMENT '商户', | |||
| `mobile` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号', | |||
| `name` text COLLATE utf8mb4_unicode_ci COMMENT '名称', | |||
| `origin_password` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '原始密码', | |||
| `password` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '密码', | |||
| `salt` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '盐值', | |||
| PRIMARY KEY (`id`), | |||
| KEY `merchant_admin_mobile` (`mobile`), | |||
| KEY `merchant_admin_merchantId` (`merchant_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_place | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place`; | |||
| CREATE TABLE `fumao_place` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `address` varchar(64) DEFAULT NULL COMMENT '地址', | |||
| `area` varchar(10) DEFAULT NULL COMMENT '区域', | |||
| `city` varchar(10) DEFAULT NULL COMMENT '城市', | |||
| `company_id` varchar(64) DEFAULT NULL COMMENT '集团', | |||
| `create_time` datetime DEFAULT NULL, | |||
| `depot_area` decimal(9,2) DEFAULT NULL COMMENT '停车场面积', | |||
| `etcp_id` varchar(128) DEFAULT NULL COMMENT 'ETCP', | |||
| `lat` varchar(12) DEFAULT NULL COMMENT '经度', | |||
| `lng` varchar(12) DEFAULT NULL COMMENT '纬度', | |||
| `maiwaidi_id` varchar(128) DEFAULT NULL COMMENT '迈外迪', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `poi` varchar(64) DEFAULT NULL COMMENT 'POI', | |||
| `province` varchar(10) DEFAULT NULL COMMENT '省份', | |||
| `selling_area` decimal(9,2) DEFAULT NULL COMMENT '营业面积', | |||
| `total_area` decimal(9,2) DEFAULT NULL COMMENT '总面积', | |||
| PRIMARY KEY (`id`), | |||
| KEY `market_companyId` (`company_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_place_admin | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place_admin`; | |||
| CREATE TABLE `fumao_place_admin` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `company_id` varchar(64) DEFAULT NULL COMMENT '集团', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `password` varchar(32) DEFAULT NULL COMMENT '密码', | |||
| `place_admin_role_id` varchar(64) DEFAULT NULL COMMENT '角色', | |||
| `place_id` varchar(64) DEFAULT NULL COMMENT '集团商场', | |||
| `salt` varchar(32) DEFAULT NULL COMMENT '盐值', | |||
| `type` int(1) DEFAULT NULL COMMENT '类型', | |||
| `origin_password` varchar(32) DEFAULT NULL COMMENT '初始密码', | |||
| PRIMARY KEY (`id`), | |||
| KEY `market_admin_mobile` (`mobile`), | |||
| KEY `market_admin_marketId` (`place_id`), | |||
| KEY `market_admin_placeId` (`place_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_place_admin_permission | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place_admin_permission`; | |||
| CREATE TABLE `fumao_place_admin_permission` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `name` varchar(32) DEFAULT NULL COMMENT '名称', | |||
| `place_admin_id` bigint(64) DEFAULT NULL COMMENT '业务管理员', | |||
| `has` int(11) DEFAULT NULL COMMENT '是否有权限', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_place_floor | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place_floor`; | |||
| CREATE TABLE `fumao_place_floor` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `area` decimal(9,2) DEFAULT NULL COMMENT '面积', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `floor` varchar(2) DEFAULT NULL COMMENT '楼层', | |||
| `image` text COMMENT '平面图', | |||
| `place_id` varchar(64) DEFAULT NULL COMMENT '商场', | |||
| `tower` varchar(2) DEFAULT NULL COMMENT '几座', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_point_transaction | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_point_transaction`; | |||
| CREATE TABLE `fumao_point_transaction` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `admin_id` bigint(64) DEFAULT NULL COMMENT '操作人', | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `customer_id` bigint(64) DEFAULT NULL COMMENT '客户', | |||
| `customer_mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `dest` int(9) DEFAULT NULL COMMENT '现在积分', | |||
| `oper` int(9) DEFAULT NULL COMMENT '操作积分', | |||
| `origin` int(9) DEFAULT NULL COMMENT '原始积分', | |||
| `trade_id` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '订单ID', | |||
| `place_id` bigint(64) DEFAULT NULL COMMENT '操作人', | |||
| PRIMARY KEY (`id`), | |||
| KEY `point_transaction_tradeId` (`trade_id`), | |||
| KEY `point_transaction_customerId` (`customer_id`), | |||
| KEY `point_transaction_placeId` (`place_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_scene_pv | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_scene_pv`; | |||
| CREATE TABLE `fumao_scene_pv` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `parking_count` bigint(9) DEFAULT NULL COMMENT '车辆数', | |||
| `push_count` bigint(9) DEFAULT NULL COMMENT '发劵量', | |||
| `write_off_count` bigint(9) DEFAULT NULL COMMENT '核销数', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_shop | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_shop`; | |||
| CREATE TABLE `fumao_shop` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `address` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地址', | |||
| `city` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '城市', | |||
| `cover` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '封面', | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `floor` bigint(64) DEFAULT NULL COMMENT '楼层', | |||
| `lat` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '经度', | |||
| `lng` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '纬度', | |||
| `merchant_id` bigint(64) DEFAULT NULL COMMENT '商户', | |||
| `number` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商铺号', | |||
| `place_id` bigint(64) DEFAULT NULL COMMENT '商场', | |||
| `poi` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'POI', | |||
| `selling_area` double(9,2) DEFAULT NULL COMMENT '营业面积', | |||
| `total_area` double(9,2) DEFAULT NULL COMMENT '建筑面积', | |||
| `area` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '城市', | |||
| `province` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '城市', | |||
| PRIMARY KEY (`id`), | |||
| KEY `shop_number` (`number`), | |||
| KEY `shop_merchantId` (`merchant_id`), | |||
| KEY `shop_placeId` (`place_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| # Dump of table fumao_shop_apply | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_shop_apply`; | |||
| CREATE TABLE `fumao_shop_apply` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `market` text COMMENT '备注', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '商铺名称', | |||
| `proposer` varchar(64) DEFAULT NULL COMMENT '申请人', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_sms | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_sms`; | |||
| CREATE TABLE `fumao_sms` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `check_count` int(11) DEFAULT NULL, | |||
| `content` varchar(255) DEFAULT NULL, | |||
| `create_time` datetime DEFAULT NULL, | |||
| `expired_time` datetime DEFAULT NULL, | |||
| `is_check` bit(1) DEFAULT NULL, | |||
| `mark` varchar(255) DEFAULT NULL, | |||
| `mobile` varchar(11) DEFAULT NULL, | |||
| `type` varchar(16) DEFAULT NULL, | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_system_admin | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_system_admin`; | |||
| CREATE TABLE `fumao_system_admin` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `password` varchar(32) DEFAULT NULL COMMENT '密码', | |||
| `salt` varchar(32) DEFAULT NULL COMMENT '盐值', | |||
| PRIMARY KEY (`id`), | |||
| KEY `system_admin_mobile` (`mobile`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_trade | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_trade`; | |||
| CREATE TABLE `fumao_trade` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `amount` decimal(9,2) DEFAULT NULL COMMENT '面额', | |||
| `coupon_id` bigint(64) DEFAULT NULL COMMENT '优惠券', | |||
| `coupon_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '优惠券名称', | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `customer_id` bigint(64) DEFAULT NULL COMMENT '客户', | |||
| `expired_time` date DEFAULT NULL COMMENT '过期时间', | |||
| `merchant_id` bigint(64) DEFAULT NULL COMMENT '商户', | |||
| `pay_time` date DEFAULT NULL COMMENT '支付时间', | |||
| `place_id` bigint(64) DEFAULT NULL COMMENT '商场', | |||
| `require_amount` decimal(9,2) DEFAULT NULL COMMENT '金额', | |||
| `shop_id` bigint(64) DEFAULT NULL COMMENT '商铺', | |||
| `status` int(1) DEFAULT NULL COMMENT '状态', | |||
| `use_time` date DEFAULT NULL COMMENT '使用时间', | |||
| PRIMARY KEY (`id`), | |||
| KEY `trade_couponId` (`coupon_id`), | |||
| KEY `trade_customerId` (`customer_id`), | |||
| KEY `trade_shopId` (`shop_id`), | |||
| KEY `trade_merchantId` (`merchant_id`), | |||
| KEY `trade_placeId` (`place_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| DROP TABLE IF EXISTS `fumao_bi_customer_register`; | |||
| CREATE TABLE `fumao_bi_customer_register` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `register_count` bigint(9) DEFAULT NULL COMMENT '注册量', | |||
| `total` bigint(9) DEFAULT NULL COMMENT '总量', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| DROP TABLE IF EXISTS `fumao_bi_trade`; | |||
| CREATE TABLE `fumao_bi_trade` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `today` bigint(9) DEFAULT NULL COMMENT '今日', | |||
| `today_cash` decimal(9,2) DEFAULT NULL COMMENT '今日金额', | |||
| `total` bigint(9) DEFAULT NULL COMMENT '总量', | |||
| `total_cash` decimal(9,2) DEFAULT NULL COMMENT '消费金额', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| DROP TABLE IF EXISTS `fumao_place_setting`; | |||
| CREATE TABLE `fumao_place_setting` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `place_id` bigint(64) DEFAULT NULL COMMENT '商场', | |||
| `type` int(1) DEFAULT NULL COMMENT '类型', | |||
| `value` text COLLATE utf8mb4_unicode_ci COMMENT '数值', | |||
| PRIMARY KEY (`id`), | |||
| KEY `place_setting_placeId` (`place_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| DROP TABLE IF EXISTS `fumao_tag`; | |||
| CREATE TABLE `fumao_tag` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `cate` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '组', | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `name` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名称', | |||
| `target_id` bigint(64) DEFAULT NULL COMMENT '目标', | |||
| `value` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '数值', | |||
| PRIMARY KEY (`id`), | |||
| KEY `tag_name` (`name`), | |||
| KEY `tag_cate` (`cate`), | |||
| KEY `tag_targetId` (`target_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| DROP TABLE IF EXISTS `fumao_bi_customer_login`; | |||
| CREATE TABLE `fumao_bi_customer_login` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `channel` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '渠道', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `customer_id` bigint(64) DEFAULT NULL COMMENT '会员', | |||
| `ip` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'IP', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| DROP TABLE IF EXISTS `fumao_coupon_channel`; | |||
| CREATE TABLE `fumao_coupon_channel` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `cate` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '分类', | |||
| `channel` int(1) DEFAULT NULL COMMENT '渠道', | |||
| `coupon_id` bigint(64) DEFAULT NULL COMMENT '优惠卷', | |||
| `create_time` datetime DEFAULT NULL COMMENT '创建时间', | |||
| `place_id` bigint(64) DEFAULT NULL COMMENT '商场', | |||
| PRIMARY KEY (`id`), | |||
| KEY `coupon_channel_couponId` (`coupon_id`), | |||
| KEY `coupon_channel_channel` (`channel`), | |||
| KEY `coupon_channel_placeId` (`place_id`), | |||
| KEY `coupon_channel_cate` (`cate`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | |||
| /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | |||
| /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | |||
| /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | |||
| /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | |||
| /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | |||
| @@ -0,0 +1,243 @@ | |||
| # ************************************************************ | |||
| # Sequel Pro SQL dump | |||
| # Version 4541 | |||
| # | |||
| # http://www.sequelpro.com/ | |||
| # https://github.com/sequelpro/sequelpro | |||
| # | |||
| # Host: 127.0.0.1 (MySQL 5.7.21) | |||
| # Database: demo | |||
| # Generation Time: 2018-07-26 03:49:04 +0000 | |||
| # ************************************************************ | |||
| /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |||
| /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |||
| /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |||
| /*!40101 SET NAMES utf8 */; | |||
| /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | |||
| /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | |||
| /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | |||
| # Dump of table fumao_company | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_company`; | |||
| CREATE TABLE `fumao_company` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `address` varchar(64) DEFAULT NULL COMMENT '地址', | |||
| `area` varchar(10) DEFAULT NULL COMMENT '区域', | |||
| `city` varchar(10) DEFAULT NULL COMMENT '城市', | |||
| `create_time` datetime DEFAULT NULL, | |||
| `lat` varchar(12) DEFAULT NULL COMMENT '经度', | |||
| `lng` varchar(12) DEFAULT NULL COMMENT '纬度', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `poi` varchar(64) DEFAULT NULL COMMENT 'POI', | |||
| `province` varchar(10) DEFAULT NULL COMMENT '省份', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_company_admin | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_company_admin`; | |||
| CREATE TABLE `fumao_company_admin` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `company_id` varchar(64) DEFAULT NULL COMMENT '集团', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `password` varchar(32) DEFAULT NULL COMMENT '密码', | |||
| `salt` varchar(32) DEFAULT NULL COMMENT '盐值', | |||
| `origin_password` varchar(32) DEFAULT NULL COMMENT '初始密码', | |||
| PRIMARY KEY (`id`), | |||
| KEY `company_admin_mobile` (`mobile`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_company_apply | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_company_apply`; | |||
| CREATE TABLE `fumao_company_apply` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `market` text COMMENT '备注', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '集团名称', | |||
| `proposer` varchar(64) DEFAULT NULL COMMENT '申请人', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_event_log | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_event_log`; | |||
| CREATE TABLE `fumao_event_log` ( | |||
| `id` bigint(20) NOT NULL AUTO_INCREMENT, | |||
| `content` longtext, | |||
| `create_time` datetime DEFAULT NULL, | |||
| `ip` varchar(255) DEFAULT NULL, | |||
| `operator` varchar(32) DEFAULT NULL, | |||
| `target` int(11) DEFAULT NULL, | |||
| `target_id` varchar(32) DEFAULT NULL, | |||
| `type` int(11) DEFAULT NULL, | |||
| PRIMARY KEY (`id`), | |||
| KEY `event_log_operator` (`operator`), | |||
| KEY `event_log_targetId` (`target_id`), | |||
| KEY `event_log_type` (`type`), | |||
| KEY `event_log_target` (`target`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_place | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place`; | |||
| CREATE TABLE `fumao_place` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `address` varchar(64) DEFAULT NULL COMMENT '地址', | |||
| `area` varchar(10) DEFAULT NULL COMMENT '区域', | |||
| `city` varchar(10) DEFAULT NULL COMMENT '城市', | |||
| `company_id` varchar(64) DEFAULT NULL COMMENT '集团', | |||
| `create_time` datetime DEFAULT NULL, | |||
| `depot_area` decimal(9,2) DEFAULT NULL COMMENT '停车场面积', | |||
| `etcp_id` varchar(128) DEFAULT NULL COMMENT 'ETCP', | |||
| `lat` varchar(12) DEFAULT NULL COMMENT '经度', | |||
| `lng` varchar(12) DEFAULT NULL COMMENT '纬度', | |||
| `maiwaidi_id` varchar(128) DEFAULT NULL COMMENT '迈外迪', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `poi` varchar(64) DEFAULT NULL COMMENT 'POI', | |||
| `province` varchar(10) DEFAULT NULL COMMENT '省份', | |||
| `selling_area` decimal(9,2) DEFAULT NULL COMMENT '营业面积', | |||
| `total_area` decimal(9,2) DEFAULT NULL COMMENT '总面积', | |||
| PRIMARY KEY (`id`), | |||
| KEY `market_companyId` (`company_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_place_admin | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place_admin`; | |||
| CREATE TABLE `fumao_place_admin` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `company_id` varchar(64) DEFAULT NULL COMMENT '集团', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `password` varchar(32) DEFAULT NULL COMMENT '密码', | |||
| `place_admin_role_id` varchar(64) DEFAULT NULL COMMENT '角色', | |||
| `place_id` varchar(64) DEFAULT NULL COMMENT '集团商场', | |||
| `salt` varchar(32) DEFAULT NULL COMMENT '盐值', | |||
| `type` int(1) DEFAULT NULL COMMENT '类型', | |||
| `origin_password` varchar(32) DEFAULT NULL COMMENT '初始密码', | |||
| PRIMARY KEY (`id`), | |||
| KEY `market_admin_mobile` (`mobile`), | |||
| KEY `market_admin_marketId` (`place_id`), | |||
| KEY `market_admin_placeId` (`place_id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_place_admin_permission | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place_admin_permission`; | |||
| CREATE TABLE `fumao_place_admin_permission` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `name` varchar(32) DEFAULT NULL COMMENT '名称', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_place_floor | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_place_floor`; | |||
| CREATE TABLE `fumao_place_floor` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `area` decimal(9,2) DEFAULT NULL COMMENT '面积', | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `floor` varchar(2) DEFAULT NULL COMMENT '楼层', | |||
| `image` text COMMENT '平面图', | |||
| `place_id` varchar(64) DEFAULT NULL COMMENT '商场', | |||
| `tower` varchar(2) DEFAULT NULL COMMENT '几座', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_shop_apply | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_shop_apply`; | |||
| CREATE TABLE `fumao_shop_apply` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `market` text COMMENT '备注', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '商铺名称', | |||
| `proposer` varchar(64) DEFAULT NULL COMMENT '申请人', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_sms | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_sms`; | |||
| CREATE TABLE `fumao_sms` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `check_count` int(11) DEFAULT NULL, | |||
| `content` varchar(255) DEFAULT NULL, | |||
| `create_time` datetime DEFAULT NULL, | |||
| `expired_time` datetime DEFAULT NULL, | |||
| `is_check` bit(1) DEFAULT NULL, | |||
| `mark` varchar(255) DEFAULT NULL, | |||
| `mobile` varchar(11) DEFAULT NULL, | |||
| `type` varchar(16) DEFAULT NULL, | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| # Dump of table fumao_system_admin | |||
| # ------------------------------------------------------------ | |||
| DROP TABLE IF EXISTS `fumao_system_admin`; | |||
| CREATE TABLE `fumao_system_admin` ( | |||
| `id` bigint(20) NOT NULL, | |||
| `create_time` date DEFAULT NULL COMMENT '创建时间', | |||
| `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', | |||
| `name` varchar(64) DEFAULT NULL COMMENT '名称', | |||
| `password` varchar(32) DEFAULT NULL COMMENT '密码', | |||
| `salt` varchar(32) DEFAULT NULL COMMENT '盐值', | |||
| PRIMARY KEY (`id`), | |||
| KEY `system_admin_mobile` (`mobile`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |||
| @@ -1,7 +1,7 @@ | |||
| 000000=ok | |||
| 000001=\u7CFB\u7EDF\u9519\u8BEF | |||
| 000002=\u5C1A\u672A\u767B\u5F55 | |||
| 000003=\u53C2\u6570\u9519\u8BEF | |||
| 000003={0} | |||
| 000004=\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF | |||
| 000005=\u5FAE\u4FE1\u9519\u8BEF | |||
| 000006=\u6CA1\u6709\u6743\u9650\u8BBF\u95EE | |||
| @@ -10,4 +10,5 @@ | |||
| 100000=\u5DF2\u5B58\u5728\u76F8\u540C\u7684\u624B\u673A\u53F7 | |||
| 100001=\u4E0D\u80FD\u5220\u9664\u81EA\u5DF1 | |||
| 100001=\u4E0D\u80FD\u5220\u9664\u81EA\u5DF1 | |||
| 100002=\u5C1A\u672A\u914D\u7F6E{0} | |||
| @@ -0,0 +1,22 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <artifactId>fumao</artifactId> | |||
| <groupId>com.chilunyc</groupId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <artifactId>fumao-bi</artifactId> | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>com.chilunyc</groupId> | |||
| <artifactId>fumao-common</artifactId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </dependency> | |||
| </dependencies> | |||
| </project> | |||
| @@ -0,0 +1,62 @@ | |||
| package com.chilunyc.fumao.bi.model; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import org.hibernate.annotations.GenericGenerator; | |||
| import org.hibernate.annotations.Parameter; | |||
| import org.springframework.data.annotation.CreatedDate; | |||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |||
| import javax.persistence.*; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @Data | |||
| @AllArgsConstructor | |||
| @NoArgsConstructor | |||
| @Builder | |||
| @Entity | |||
| @Table(name = "fumao_bi_customer_login", indexes = { | |||
| }) | |||
| @EntityListeners(AuditingEntityListener.class) | |||
| public class BiCustomerLogin implements Serializable { | |||
| /** | |||
| * 编号 | |||
| */ | |||
| @Id | |||
| @Column(length = 64) | |||
| @GeneratedValue(generator = "custom") | |||
| @GenericGenerator(name = "custom", strategy = "com.chilunyc.fumao.common.util.jpa.CustomIdentifierGenerator", parameters = {@Parameter(name = "type", value = "Number")}) | |||
| private Long id; | |||
| /** | |||
| * 会员 | |||
| */ | |||
| @Column(columnDefinition = "bigint(64) comment '会员'") | |||
| private Long customerId; | |||
| /** | |||
| * IP | |||
| */ | |||
| @Column(columnDefinition = "varchar(20) comment 'IP'") | |||
| private String ip; | |||
| /** | |||
| * 渠道 | |||
| */ | |||
| @Column(columnDefinition = "varchar(16) comment '渠道'") | |||
| private String channel; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @CreatedDate | |||
| @Column(columnDefinition = "date comment '创建时间'") | |||
| private Date createTime; | |||
| } | |||
| @@ -0,0 +1,56 @@ | |||
| package com.chilunyc.fumao.bi.model; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import org.hibernate.annotations.GenericGenerator; | |||
| import org.hibernate.annotations.Parameter; | |||
| import org.springframework.data.annotation.CreatedDate; | |||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |||
| import javax.persistence.*; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @Data | |||
| @AllArgsConstructor | |||
| @NoArgsConstructor | |||
| @Builder | |||
| @Entity | |||
| @Table(name = "fumao_bi_customer_register", indexes = { | |||
| }) | |||
| @EntityListeners(AuditingEntityListener.class) | |||
| public class BiCustomerRegister implements Serializable { | |||
| /** | |||
| * 编号 | |||
| */ | |||
| @Id | |||
| @Column(length = 64) | |||
| @GeneratedValue(generator = "custom") | |||
| @GenericGenerator(name = "custom", strategy = "com.chilunyc.fumao.common.util.jpa.CustomIdentifierGenerator", parameters = {@Parameter(name = "type", value = "Number")}) | |||
| private Long id; | |||
| /** | |||
| * 总量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '总量'") | |||
| private Long total; | |||
| /** | |||
| * 注册量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '注册量'") | |||
| private Long registerCount; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @Temporal(TemporalType.DATE) | |||
| @Column(columnDefinition = "date comment '创建时间'") | |||
| private Date createTime; | |||
| } | |||
| @@ -0,0 +1,68 @@ | |||
| package com.chilunyc.fumao.bi.model; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import org.hibernate.annotations.GenericGenerator; | |||
| import org.hibernate.annotations.Parameter; | |||
| import org.springframework.data.annotation.CreatedDate; | |||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |||
| import javax.persistence.*; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @Data | |||
| @AllArgsConstructor | |||
| @NoArgsConstructor | |||
| @Builder | |||
| @Entity | |||
| @Table(name = "fumao_bi_trade", indexes = { | |||
| }) | |||
| @EntityListeners(AuditingEntityListener.class) | |||
| public class BiTrade implements Serializable { | |||
| /** | |||
| * 编号 | |||
| */ | |||
| @Id | |||
| @Column(length = 64) | |||
| @GeneratedValue(generator = "custom") | |||
| @GenericGenerator(name = "custom", strategy = "com.chilunyc.fumao.common.util.jpa.CustomIdentifierGenerator", parameters = {@Parameter(name = "type", value = "Number")}) | |||
| private Long id; | |||
| /** | |||
| * 总量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '总量'") | |||
| private Long total; | |||
| /** | |||
| * 今日 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '今日'") | |||
| private Long today; | |||
| /** | |||
| * 消费金额 | |||
| */ | |||
| @Column(columnDefinition = "decimal(9,2) comment '消费金额'") | |||
| private Double totalCash; | |||
| /** | |||
| * 今日金额 | |||
| */ | |||
| @Column(columnDefinition = "decimal(9,2) comment '今日金额'") | |||
| private Double todayCash; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @CreatedDate | |||
| @Column(columnDefinition = "date comment '创建时间'") | |||
| private Date createTime; | |||
| } | |||
| @@ -0,0 +1,81 @@ | |||
| package com.chilunyc.fumao.bi.model; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import org.hibernate.annotations.GenericGenerator; | |||
| import org.hibernate.annotations.Parameter; | |||
| import org.springframework.data.annotation.CreatedDate; | |||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |||
| import javax.persistence.*; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @Data | |||
| @AllArgsConstructor | |||
| @NoArgsConstructor | |||
| @Builder | |||
| @Entity | |||
| @Table(name = "fumao_client_pv", indexes = { | |||
| }) | |||
| @EntityListeners(AuditingEntityListener.class) | |||
| public class ClientPv implements Serializable { | |||
| /** | |||
| * 编号 | |||
| */ | |||
| @Id | |||
| @Column(length = 64) | |||
| @GeneratedValue(generator = "custom") | |||
| @GenericGenerator(name = "custom", strategy = "com.chilunyc.fumao.common.util.jpa.CustomIdentifierGenerator", parameters = {@Parameter(name = "type", value = "Number")}) | |||
| private Long id; | |||
| /** | |||
| * pv | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment 'pv'") | |||
| private Long pv; | |||
| /** | |||
| * uv | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment 'uv'") | |||
| private Long uv; | |||
| /** | |||
| * 领取人数 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '领取人数'") | |||
| private Long couponCustomerCount; | |||
| /** | |||
| * 领取量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '领取量'") | |||
| private Long couponCount; | |||
| /** | |||
| * 核销人数 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '核销人数'") | |||
| private Long writeOffCustomerCount; | |||
| /** | |||
| * 核销量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '核销量'") | |||
| private Long writeOffCount; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @CreatedDate | |||
| @Column(columnDefinition = "date comment '创建时间'") | |||
| private Date createTime; | |||
| } | |||
| @@ -0,0 +1,92 @@ | |||
| package com.chilunyc.fumao.bi.model; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import org.hibernate.annotations.GenericGenerator; | |||
| import org.hibernate.annotations.Parameter; | |||
| import org.springframework.data.annotation.CreatedDate; | |||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |||
| import javax.persistence.*; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @Data | |||
| @AllArgsConstructor | |||
| @NoArgsConstructor | |||
| @Builder | |||
| @Entity | |||
| @Table(name = "fumao_coupon_pv", indexes = { | |||
| }) | |||
| @EntityListeners(AuditingEntityListener.class) | |||
| public class CouponPv implements Serializable { | |||
| /** | |||
| * 编号 | |||
| */ | |||
| @Id | |||
| @Column(length = 64) | |||
| @GeneratedValue(generator = "custom") | |||
| @GenericGenerator(name = "custom", strategy = "com.chilunyc.fumao.common.util.jpa.CustomIdentifierGenerator", parameters = {@Parameter(name = "type", value = "Number")}) | |||
| private Long id; | |||
| /** | |||
| * | |||
| */ | |||
| @Column(columnDefinition = "varchar(64) comment '优惠券名称'") | |||
| private String couponName; | |||
| /** | |||
| * | |||
| */ | |||
| @Column(columnDefinition = "varchar(64) comment '优惠券类型'") | |||
| private String couponKind; | |||
| /** | |||
| * pv | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment 'pv'") | |||
| private Long pv; | |||
| /** | |||
| * uv | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment 'uv'") | |||
| private Long uv; | |||
| /** | |||
| * 领取人数 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '领取人数'") | |||
| private Long couponCustomerCount; | |||
| /** | |||
| * 领取量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '领取量'") | |||
| private Long couponCount; | |||
| /** | |||
| * 核销人数 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '核销人数'") | |||
| private Long writeOffCustomerCount; | |||
| /** | |||
| * 核销量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '核销量'") | |||
| private Long writeOffCount; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @CreatedDate | |||
| @Column(columnDefinition = "date comment '创建时间'") | |||
| private Date createTime; | |||
| } | |||
| @@ -0,0 +1,62 @@ | |||
| package com.chilunyc.fumao.bi.model; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Builder; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import org.hibernate.annotations.GenericGenerator; | |||
| import org.hibernate.annotations.Parameter; | |||
| import org.springframework.data.annotation.CreatedDate; | |||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | |||
| import javax.persistence.*; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @Data | |||
| @AllArgsConstructor | |||
| @NoArgsConstructor | |||
| @Builder | |||
| @Entity | |||
| @Table(name = "fumao_scene_pv", indexes = { | |||
| }) | |||
| @EntityListeners(AuditingEntityListener.class) | |||
| public class ScenePv implements Serializable { | |||
| /** | |||
| * 编号 | |||
| */ | |||
| @Id | |||
| @Column(length = 64) | |||
| @GeneratedValue(generator = "custom") | |||
| @GenericGenerator(name = "custom", strategy = "com.chilunyc.fumao.common.util.jpa.CustomIdentifierGenerator", parameters = {@Parameter(name = "type", value = "Number")}) | |||
| private Long id; | |||
| /** | |||
| * 车辆数 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '车辆数'") | |||
| private Long parkingCount; | |||
| /** | |||
| * 核销数 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '核销数'") | |||
| private Long writeOffCount; | |||
| /** | |||
| * 发劵量 | |||
| */ | |||
| @Column(columnDefinition = "bigint(9) comment '发劵量'") | |||
| private Long pushCount; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @CreatedDate | |||
| @Column(columnDefinition = "date comment '创建时间'") | |||
| private Date createTime; | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.chilunyc.fumao.bi.repository; | |||
| import com.chilunyc.fumao.bi.model.BiCustomerLogin; | |||
| import com.chilunyc.fumao.common.response.KeyValue; | |||
| import org.springframework.data.jpa.repository.JpaRepository; | |||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
| import org.springframework.data.jpa.repository.Query; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| public interface BiCustomerLoginRepository extends JpaRepository<BiCustomerLogin, Long>, JpaSpecificationExecutor<BiCustomerLogin> { | |||
| @Query( | |||
| "select new com.chilunyc.fumao.common.response.KeyValue(DATE_FORMAT(b.createTime,'%Y-%m-%d'), count(b)) from BiCustomerLogin b where b.createTime >= ?1 and b.createTime <= ?2 group by b.createTime" | |||
| ) | |||
| List<KeyValue> groupByCreateTime(Date date, Date date1); | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.chilunyc.fumao.bi.repository; | |||
| import com.chilunyc.fumao.bi.model.BiCustomerRegister; | |||
| import org.springframework.data.jpa.repository.JpaRepository; | |||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| public interface BiCustomerRegisterRepository extends JpaRepository<BiCustomerRegister, Long>, JpaSpecificationExecutor<BiCustomerRegister> { | |||
| BiCustomerRegister findByCreateTime(Date date); | |||
| Long countByCreateTimeBetween(Date date, Date date1); | |||
| Long countByCreateTime(Date date); | |||
| List<BiCustomerRegister> findByCreateTimeBetween(Date date, Date date1); | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.chilunyc.fumao.bi.repository; | |||
| import com.chilunyc.fumao.bi.model.BiTrade; | |||
| import org.springframework.data.jpa.repository.JpaRepository; | |||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| public interface BiTradeRepository extends JpaRepository<BiTrade, Long>, JpaSpecificationExecutor<BiTrade> { | |||
| List<BiTrade> findByCreateTimeBetween(Date date, Date date1); | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.chilunyc.fumao.bi.repository; | |||
| import com.chilunyc.fumao.bi.model.ClientPv; | |||
| import org.springframework.data.jpa.repository.JpaRepository; | |||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| public interface ClientPvRepository extends JpaRepository<ClientPv, Long>, JpaSpecificationExecutor<ClientPv> { | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.chilunyc.fumao.bi.repository; | |||
| import com.chilunyc.fumao.bi.model.CouponPv; | |||
| import org.springframework.data.jpa.repository.JpaRepository; | |||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| public interface CouponPvRepository extends JpaRepository<CouponPv, Long>, JpaSpecificationExecutor<CouponPv> { | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.chilunyc.fumao.bi.repository; | |||
| import com.chilunyc.fumao.bi.model.ScenePv; | |||
| import org.springframework.data.jpa.repository.JpaRepository; | |||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| public interface ScenePvRepository extends JpaRepository<ScenePv, Long>, JpaSpecificationExecutor<ScenePv> { | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.chilunyc.fumao.bi.request.biCustomerRegister; | |||
| import com.chilunyc.fumao.common.request.PageRequest; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItem; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItems; | |||
| import lombok.Data; | |||
| /** | |||
| * | |||
| */ | |||
| @SortItems({ | |||
| @SortItem(column = "createTime") | |||
| }) | |||
| @Data | |||
| public class BiCustomerRegisterPageRequest extends PageRequest { | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.chilunyc.fumao.bi.request.clientPv; | |||
| import com.chilunyc.fumao.common.request.PageRequest; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryItem; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryType; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItem; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItems; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @SortItems({ | |||
| @SortItem(column = "createTime") | |||
| }) | |||
| @Data | |||
| public class ClientPvPageRequest extends PageRequest { | |||
| @QueryItem(type = QueryType.betweenDate, column = "createTime") | |||
| private Date[] timeRange; | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.chilunyc.fumao.bi.request.couponPv; | |||
| import com.chilunyc.fumao.common.request.PageRequest; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItem; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItems; | |||
| import lombok.Data; | |||
| /** | |||
| * | |||
| */ | |||
| @SortItems({ | |||
| @SortItem(column = "createTime") | |||
| }) | |||
| @Data | |||
| public class CouponPvPageRequest extends PageRequest { | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.chilunyc.fumao.bi.request.scenePv; | |||
| import com.chilunyc.fumao.common.request.PageRequest; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryItem; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryType; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItem; | |||
| import com.chilunyc.fumao.common.util.jpa.query.SortItems; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @SortItems({ | |||
| @SortItem(column = "createTime") | |||
| }) | |||
| @Data | |||
| public class ScenePvPageRequest extends PageRequest { | |||
| @QueryItem(type = QueryType.betweenDate, column = "createTime") | |||
| private Date[] timeRange; | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.chilunyc.fumao.bi.service; | |||
| import com.chilunyc.fumao.bi.repository.BiCustomerLoginRepository; | |||
| import com.chilunyc.fumao.common.response.KeyValue; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Service | |||
| @Transactional | |||
| public class BiCustomerLoginService { | |||
| @Autowired | |||
| private BiCustomerLoginRepository biCustomerLoginRepository; | |||
| public List<KeyValue> range(Date[] timeRange) { | |||
| return biCustomerLoginRepository.groupByCreateTime(timeRange[0], timeRange[1]); | |||
| } | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| package com.chilunyc.fumao.bi.service; | |||
| import com.chilunyc.fumao.bi.model.BiCustomerRegister; | |||
| import com.chilunyc.fumao.bi.repository.BiCustomerRegisterRepository; | |||
| import com.chilunyc.fumao.bi.request.biCustomerRegister.BiCustomerRegisterPageRequest; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryBuilder; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Service | |||
| @Transactional | |||
| public class BiCustomerRegisterService { | |||
| @Autowired | |||
| private BiCustomerRegisterRepository biCustomerRegisterRepository; | |||
| public Page<BiCustomerRegister> page(BiCustomerRegisterPageRequest request) { | |||
| return biCustomerRegisterRepository.findAll(QueryBuilder.build(request), request.getPage()); | |||
| } | |||
| /** | |||
| * @param date | |||
| * @param allCount | |||
| * @return | |||
| */ | |||
| public synchronized BiCustomerRegister findByDate(Date date, Long allCount) { | |||
| BiCustomerRegister customerRegister = biCustomerRegisterRepository.findByCreateTime(date); | |||
| if (customerRegister == null) { | |||
| customerRegister = biCustomerRegisterRepository.save( | |||
| BiCustomerRegister | |||
| .builder() | |||
| .createTime(date) | |||
| .registerCount(0L) | |||
| .total(allCount) | |||
| .build() | |||
| ); | |||
| } | |||
| return customerRegister; | |||
| } | |||
| public List<BiCustomerRegister> range(Date[] timeRange) { | |||
| return biCustomerRegisterRepository.findByCreateTimeBetween(timeRange[0], timeRange[1]); | |||
| } | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| package com.chilunyc.fumao.bi.service; | |||
| import com.chilunyc.fumao.bi.model.BiTrade; | |||
| import com.chilunyc.fumao.bi.repository.BiTradeRepository; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Service | |||
| @Transactional | |||
| public class BiTradeService { | |||
| @Autowired | |||
| private BiTradeRepository biTradeRepository; | |||
| public List<BiTrade> range(Date[] timeRange) { | |||
| return biTradeRepository.findByCreateTimeBetween(timeRange[0], timeRange[1]); | |||
| } | |||
| } | |||
| @@ -0,0 +1,47 @@ | |||
| package com.chilunyc.fumao.bi.service; | |||
| import com.chilunyc.fumao.bi.model.ClientPv; | |||
| import com.chilunyc.fumao.bi.repository.ClientPvRepository; | |||
| import com.chilunyc.fumao.bi.request.clientPv.ClientPvPageRequest; | |||
| import com.chilunyc.fumao.common.context.RequestHolder; | |||
| import com.chilunyc.fumao.common.log.model.EventTarget; | |||
| import com.chilunyc.fumao.common.log.model.EventType; | |||
| import com.chilunyc.fumao.common.log.service.EventService; | |||
| import com.chilunyc.fumao.common.util.BeanHelper; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryBuilder; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Service | |||
| @Transactional | |||
| public class ClientPvService { | |||
| @Autowired | |||
| private ClientPvRepository clientPvRepository; | |||
| @Autowired | |||
| private EventService eventService; | |||
| public Page<ClientPv> page(ClientPvPageRequest request) { | |||
| return clientPvRepository.findAll(QueryBuilder.build(request), request.getPage()); | |||
| } | |||
| public ClientPv find(Long id) { | |||
| ClientPv one = clientPvRepository.findOne(id); | |||
| return one; | |||
| } | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.chilunyc.fumao.bi.service; | |||
| import com.chilunyc.fumao.bi.model.CouponPv; | |||
| import com.chilunyc.fumao.bi.repository.CouponPvRepository; | |||
| import com.chilunyc.fumao.bi.request.couponPv.CouponPvPageRequest; | |||
| import com.chilunyc.fumao.common.context.RequestHolder; | |||
| import com.chilunyc.fumao.common.log.model.EventTarget; | |||
| import com.chilunyc.fumao.common.log.model.EventType; | |||
| import com.chilunyc.fumao.common.log.service.EventService; | |||
| import com.chilunyc.fumao.common.request.IdsRequest; | |||
| import com.chilunyc.fumao.common.util.BeanHelper; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryBuilder; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Service | |||
| @Transactional | |||
| public class CouponPvService { | |||
| @Autowired | |||
| private CouponPvRepository couponPvRepository; | |||
| @Autowired | |||
| private EventService eventService; | |||
| public Page<CouponPv> page(CouponPvPageRequest request) { | |||
| return couponPvRepository.findAll(QueryBuilder.build(request), request.getPage()); | |||
| } | |||
| public CouponPv find(Long id) { | |||
| CouponPv one = couponPvRepository.findOne(id); | |||
| return one; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.chilunyc.fumao.bi.service; | |||
| import com.chilunyc.fumao.bi.model.ScenePv; | |||
| import com.chilunyc.fumao.bi.repository.ScenePvRepository; | |||
| import com.chilunyc.fumao.bi.request.scenePv.ScenePvPageRequest; | |||
| import com.chilunyc.fumao.common.log.service.EventService; | |||
| import com.chilunyc.fumao.common.util.jpa.query.QueryBuilder; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| /** | |||
| * | |||
| */ | |||
| @Log4j | |||
| @Service | |||
| @Transactional | |||
| public class ScenePvService { | |||
| @Autowired | |||
| private ScenePvRepository scenePvRepository; | |||
| @Autowired | |||
| private EventService eventService; | |||
| public Page<ScenePv> page(ScenePvPageRequest request) { | |||
| return scenePvRepository.findAll(QueryBuilder.build(request), request.getPage()); | |||
| } | |||
| public ScenePv find(Long id) { | |||
| ScenePv one = scenePvRepository.findOne(id); | |||
| return one; | |||
| } | |||
| } | |||
| @@ -4,7 +4,7 @@ | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <artifactId>fumao</artifactId> | |||
| <groupId>com.aki</groupId> | |||
| <groupId>com.chilunyc</groupId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| @@ -44,20 +44,6 @@ | |||
| <artifactId>aliyun-sdk-oss</artifactId> | |||
| <version>2.6.1</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.aliyun</groupId> | |||
| <artifactId>aliyun-java-sdk-core</artifactId> | |||
| <version>3.2.3</version> | |||
| <scope>system</scope> | |||
| <systemPath>${project.basedir}/src/main/lib/aliyun-java-sdk-core-3.2.2.jar</systemPath> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>com.aliyun</groupId> | |||
| <artifactId>aliyun-java-sdk-dysmsapi</artifactId> | |||
| <version>1.0.0</version> | |||
| <scope>system</scope> | |||
| <systemPath>${project.basedir}/src/main/lib/aliyun-java-sdk-dysmsapi-1.0.0-SANPSHOT.jar</systemPath> | |||
| </dependency> | |||
| <!-- 权限框架 --> | |||
| <dependency> | |||
| @@ -144,6 +130,11 @@ | |||
| </dependency> | |||
| <!-- jpa --> | |||
| <dependency> | |||
| <groupId>org.flywaydb</groupId> | |||
| <artifactId>flyway-core</artifactId> | |||
| <version>5.1.4</version> | |||
| </dependency> | |||
| <dependency> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-data-jpa</artifactId> | |||
| @@ -0,0 +1,32 @@ | |||
| package com.chilunyc.fumao.common.db.config; | |||
| import com.chilunyc.fumao.common.db.datasource.DynamicDataSource; | |||
| import com.chilunyc.fumao.common.db.flyway.FlywayService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import javax.sql.DataSource; | |||
| /** | |||
| * on 2018/7/26. | |||
| */ | |||
| @Configuration | |||
| @EnableConfigurationProperties(DBProperties.class) | |||
| public class DBConfiguration { | |||
| @Autowired | |||
| DBProperties dbProperties; | |||
| @Autowired | |||
| FlywayService flywayService; | |||
| @Bean | |||
| DataSource dataSource() { | |||
| DynamicDataSource dataSource = new DynamicDataSource(); | |||
| DataSource init = flywayService.init("f_system", "classpath:/flyway/system"); | |||
| dataSource.addDataSource("master", init, true); | |||
| return dataSource; | |||
| } | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.chilunyc.fumao.common.db.config; | |||
| import com.zaxxer.hikari.HikariDataSource; | |||
| import lombok.Data; | |||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||
| import javax.sql.DataSource; | |||
| /** | |||
| * on 2018/7/26. | |||
| */ | |||
| @Data | |||
| @ConfigurationProperties("db") | |||
| public class DBProperties { | |||
| private String host; | |||
| private String port; | |||
| private String user; | |||
| private String password; | |||
| private int pool; | |||
| public String getURL(String database) { | |||
| return String.format( | |||
| "jdbc:mysql://%s:%s/%s?&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false&connectTimeout=0", | |||
| host, | |||
| port, | |||
| database | |||
| ); | |||
| } | |||
| public HikariDataSource getDataSource(String database) { | |||
| HikariDataSource hikariDataSource = new HikariDataSource(); | |||
| hikariDataSource.setDriverClassName("com.mysql.jdbc.Driver"); | |||
| hikariDataSource.setUsername(user); | |||
| hikariDataSource.setPassword(password); | |||
| hikariDataSource.setJdbcUrl(getURL(database)); | |||
| hikariDataSource.setConnectionInitSql("select 1"); | |||
| hikariDataSource.setConnectionTimeout(30 * 1000); | |||
| hikariDataSource.setIdleTimeout(10 * 60 * 1000); | |||
| hikariDataSource.setMaximumPoolSize(pool); | |||
| hikariDataSource.setMinimumIdle(10); | |||
| return hikariDataSource; | |||
| } | |||
| } | |||
| @@ -0,0 +1,57 @@ | |||
| package com.chilunyc.fumao.common.db.datasource; | |||
| import com.zaxxer.hikari.HikariDataSource; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.apache.commons.lang.StringUtils; | |||
| import org.springframework.beans.factory.DisposableBean; | |||
| import org.springframework.jdbc.datasource.AbstractDataSource; | |||
| import javax.sql.DataSource; | |||
| import java.sql.Connection; | |||
| import java.sql.SQLException; | |||
| import java.util.Map; | |||
| import java.util.concurrent.ConcurrentHashMap; | |||
| /** | |||
| * on 2018/7/26. | |||
| */ | |||
| @Log4j | |||
| public class DynamicDataSource extends AbstractDataSource implements DisposableBean { | |||
| private Map<String, DataSource> dataSourceMap = new ConcurrentHashMap<>(); | |||
| private String defaultDbName; | |||
| /** | |||
| * @param dbName | |||
| * @param dataSource | |||
| */ | |||
| public void addDataSource(String dbName, DataSource dataSource, boolean isDefault) { | |||
| dataSourceMap.put(dbName, dataSource); | |||
| if (isDefault) { | |||
| this.defaultDbName = dbName; | |||
| } | |||
| } | |||
| public Connection getConnection() throws SQLException { | |||
| String s = DynamicDataSourceHolder.get(); | |||
| if (StringUtils.isBlank(s)) { | |||
| s = defaultDbName; | |||
| } | |||
| if (log.isInfoEnabled()) { | |||
| log.info("使用 =>[ " + s + " ]库"); | |||
| } | |||
| return dataSourceMap.get(s).getConnection(); | |||
| } | |||
| public Connection getConnection(String username, String password) throws SQLException { | |||
| return getConnection(); | |||
| } | |||
| @Override | |||
| public void destroy() throws Exception { | |||
| dataSourceMap.values().forEach(dataSource -> { | |||
| ((HikariDataSource) dataSource).close(); | |||
| }); | |||
| } | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.chilunyc.fumao.common.db.datasource; | |||
| /** | |||
| * on 2018/7/26. | |||
| */ | |||
| public final class DynamicDataSourceHolder { | |||
| private static final ThreadLocal<String> dbNameMap = new ThreadLocal<>(); | |||
| public static void set(String dbName) { | |||
| dbNameMap.set(dbName); | |||
| } | |||
| public static String get() { | |||
| return dbNameMap.get(); | |||
| } | |||
| public static void remove() { | |||
| dbNameMap.remove(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| package com.chilunyc.fumao.common.db.flyway; | |||
| import com.chilunyc.fumao.common.db.config.DBProperties; | |||
| import com.zaxxer.hikari.HikariDataSource; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.flywaydb.core.Flyway; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.jdbc.core.JdbcTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| /** | |||
| * on 2018/7/26. | |||
| */ | |||
| @Log4j | |||
| @Service | |||
| public class FlywayService { | |||
| @Autowired | |||
| DBProperties dbProperties; | |||
| public HikariDataSource init(String database, String scripts) { | |||
| HikariDataSource dataSource = dbProperties.getDataSource(""); | |||
| // 判断是否创建数据库, 然后关闭 | |||
| JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); | |||
| if (jdbcTemplate.queryForList(String.format("show databases like '%s'", database)).size() == 0) { | |||
| jdbcTemplate.execute(String.format("CREATE DATABASE `%s` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", database)); | |||
| } | |||
| dataSource.close(); | |||
| // | |||
| Flyway flyway = new Flyway(); | |||
| flyway.setDataSource(dbProperties.getURL(database), dbProperties.getUser(), dbProperties.getPassword()); | |||
| flyway.setLocations(scripts); | |||
| flyway.migrate(); | |||
| // | |||
| log.info("主库同步完成, 设置主库成功"); | |||
| return dbProperties.getDataSource(database); | |||
| } | |||
| } | |||
| @@ -5,6 +5,5 @@ package com.chilunyc.fumao.common.enums; | |||
| */ | |||
| public enum YesOrNo { | |||
| Yes, | |||
| No | |||
| } | |||
| @@ -9,7 +9,7 @@ import lombok.NoArgsConstructor; | |||
| import java.math.BigDecimal; | |||
| /** | |||
| * Created by Tkk on 2018/7/24. | |||
| * on 2018/7/24. | |||
| */ | |||
| @Data | |||
| @NoArgsConstructor | |||
| @@ -4,7 +4,7 @@ import com.chilunyc.fumao.common.request.PageRequest; | |||
| import lombok.Data; | |||
| /** | |||
| * Created by Tkk on 2018/7/24. | |||
| * on 2018/7/24. | |||
| */ | |||
| @Data | |||
| public class LBSPoiRequest extends PageRequest { | |||
| @@ -4,5 +4,5 @@ package com.chilunyc.fumao.common.log.model; | |||
| * | |||
| */ | |||
| public enum EventTarget { | |||
| System, Company, None | |||
| System, Company, Place, None | |||
| } | |||
| @@ -8,5 +8,5 @@ public enum EventType { | |||
| Error, | |||
| // 权限 | |||
| RoleEdit, RoleDelete, PermissionEdit, PermissionRemove, SendMsg, 编辑系统管理员, 删除系统管理员, 编辑集团, 删除集团, 编辑商场, 删除商场, 编辑商场楼层, 删除商场楼层, 编辑集团申请, 删除集团申请, 编辑商铺申请, 删除商铺申请, 编辑集团管理员, 删除集团管理员, 编辑商场管理员角色, 删除商场管理员角色, 编辑商场管理员, 删除商场管理员, | |||
| RoleEdit, RoleDelete, PermissionEdit, PermissionRemove, SendMsg, 编辑系统管理员, 删除系统管理员, 编辑集团, 删除集团, 编辑商场, 删除商场, 编辑商场楼层, 删除商场楼层, 编辑集团申请, 删除集团申请, 编辑商铺申请, 删除商铺申请, 编辑集团管理员, 删除集团管理员, 编辑商场管理员角色, 删除商场管理员角色, 编辑商场管理员, 删除商场管理员, 编辑顾客, 删除顾客, 编辑订单, 删除订单, 编辑积分, 删除积分, 编辑商铺, 删除商铺, 编辑商户管理员, 删除商户管理员, 编辑商户, 删除商户, 编辑优惠券, 删除优惠券, 编辑C端数据, 删除C端数据, 编辑优惠券数据, 删除优惠券数据, 编辑场景数据, 删除场景数据, 新增商场管理员, 积分补录, | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.chilunyc.fumao.common.request; | |||
| import lombok.Data; | |||
| import org.hibernate.validator.constraints.NotBlank; | |||
| import javax.validation.constraints.NotNull; | |||
| import javax.validation.constraints.Size; | |||
| import java.util.List; | |||
| @@ -10,11 +11,11 @@ import java.util.List; | |||
| * | |||
| */ | |||
| @Data | |||
| public class AssignsRequest { | |||
| public class AssignsRequest<T> { | |||
| @Size(min = 0, message = "目标不存在") | |||
| private List<String> id; | |||
| private List<T> ids; | |||
| @NotBlank(message = "分配数据为空") | |||
| private String targetId; | |||
| @NotNull(message = "分配数据为空") | |||
| private T targetId; | |||
| } | |||
| @@ -2,8 +2,6 @@ package com.chilunyc.fumao.common.request; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| /** | |||
| * | |||
| */ | |||
| @@ -14,16 +12,7 @@ public class PageRequest { | |||
| private int page; | |||
| private Date[] timeRange; | |||
| public Date getStartTime(){ | |||
| return timeRange != null && timeRange.length == 2 ? timeRange[0] : null; | |||
| } | |||
| public Date getEndTime(){ | |||
| return timeRange != null && timeRange.length == 2 ? timeRange[1] : null; | |||
| } | |||
| /** | |||
| /** | |||
| * @return | |||
| */ | |||
| @@ -0,0 +1,16 @@ | |||
| package com.chilunyc.fumao.common.request; | |||
| import lombok.Data; | |||
| import javax.validation.constraints.Size; | |||
| import java.util.Date; | |||
| /** | |||
| * on 2018/8/1. | |||
| */ | |||
| @Data | |||
| public class TimeRangeRequest { | |||
| @Size(min = 2, max = 2, message = "请选择时间范围") | |||
| Date[] timeRange; | |||
| } | |||
| @@ -1,7 +1,7 @@ | |||
| package com.chilunyc.fumao.common.shiro; | |||
| /** | |||
| * Created by Tkk on 2018/7/23. | |||
| * on 2018/7/23. | |||
| */ | |||
| public interface AuthRoles { | |||
| @@ -20,6 +20,21 @@ public interface AuthRoles { | |||
| /** | |||
| * | |||
| */ | |||
| String MarketAdmin = "MarketAdmin"; | |||
| String MarketAdminExp = "hasAuthority('MarketAdmin')"; | |||
| String PlaceAdmin = "PlaceAdmin"; | |||
| String PlaceAdminExp = "hasAuthority('PlaceAdmin')"; | |||
| /** | |||
| * 业务管理员权限 | |||
| */ | |||
| String PlaceCustomerExp = "hasAuthority('customer')"; | |||
| String PlaceDataExp = "hasAuthority('data')"; | |||
| String PlaceCouponExp = "hasAuthority('coupon')"; | |||
| String PlaceMerchantExp = "hasAuthority('merchant')"; | |||
| String PlaceAccountExp = "hasAuthority('account')"; | |||
| /** | |||
| * | |||
| */ | |||
| String MerchantAdmin = "MerchantAdmin"; | |||
| String MerchantAdminExp = "hasAuthority('MerchantAdmin')"; | |||
| } | |||
| @@ -14,7 +14,7 @@ import java.util.stream.Collectors; | |||
| import java.util.stream.Stream; | |||
| /** | |||
| * Created by Tkk on 2018/7/23. | |||
| * on 2018/7/23. | |||
| */ | |||
| @Data | |||
| @AllArgsConstructor | |||
| @@ -25,4 +25,14 @@ public class DateHelper { | |||
| c2.setTime(date1); | |||
| return c1.get(date2) == c2.get(date2); | |||
| } | |||
| public static Date toDate(int i) { | |||
| Calendar c1 = Calendar.getInstance(); | |||
| c1.add(Calendar.DATE, i); | |||
| c1.set(Calendar.HOUR, 0); | |||
| c1.set(Calendar.SECOND, 0); | |||
| c1.set(Calendar.MINUTE, 0); | |||
| c1.set(Calendar.MILLISECOND, 0); | |||
| return c1.getTime(); | |||
| } | |||
| } | |||
| @@ -2,21 +2,23 @@ package com.chilunyc.fumao.common.util.jpa.query; | |||
| import lombok.AllArgsConstructor; | |||
| import lombok.Data; | |||
| import lombok.extern.log4j.Log4j; | |||
| import org.apache.commons.lang.StringUtils; | |||
| import org.springframework.data.jpa.domain.Specification; | |||
| import org.springframework.util.ReflectionUtils; | |||
| import javax.persistence.criteria.Predicate; | |||
| import java.lang.annotation.Annotation; | |||
| import javax.persistence.criteria.*; | |||
| import java.lang.reflect.Field; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.concurrent.ConcurrentHashMap; | |||
| /** | |||
| * Created by Tkk on 2018/7/21. | |||
| * on 2018/7/21. | |||
| */ | |||
| @Log4j | |||
| public class QueryBuilder { | |||
| @Data | |||
| @@ -66,35 +68,35 @@ public class QueryBuilder { | |||
| path = desc.field.getName(); | |||
| } | |||
| // | |||
| switch (desc.queryItem.type()) { | |||
| case equal: | |||
| predicates.add(cb.equal(root.get(path), value)); | |||
| break; | |||
| case like: | |||
| predicates.add(cb.like(root.get(path), "%" + value + "%")); | |||
| break; | |||
| case gt: | |||
| predicates.add(cb.gt(root.get(path), (Number) value)); | |||
| break; | |||
| case lt: | |||
| predicates.add(cb.lt(root.get(path), (Number) value)); | |||
| break; | |||
| case ge: | |||
| predicates.add(cb.ge(root.get(path), (Number) value)); | |||
| break; | |||
| case le: | |||
| predicates.add(cb.le(root.get(path), (Number) value)); | |||
| break; | |||
| case notEqual: | |||
| predicates.add(cb.notEqual(root.get(path), value)); | |||
| break; | |||
| case notLike: | |||
| predicates.add(cb.notLike(root.get(path), "%" + value + "%")); | |||
| break; | |||
| case rightLike: | |||
| predicates.add(cb.like(root.get(path), value + "%")); | |||
| break; | |||
| // 有join查询 | |||
| if (!desc.queryItem.join().equals(QueryJoinType.None)) { | |||
| String[] split = StringUtils.split(path, "."); | |||
| Join join = null; | |||
| switch (desc.queryItem.join()) { | |||
| case Inner: | |||
| join = root.join(split[0], JoinType.INNER); | |||
| break; | |||
| case Left: | |||
| join = root.join(split[0], JoinType.LEFT); | |||
| break; | |||
| case Right: | |||
| join = root.join(split[0], JoinType.RIGHT); | |||
| break; | |||
| } | |||
| if (join != null) { | |||
| Predicate predicate = toCondition(desc.queryItem, value, cb, join.get(split[1])); | |||
| if (predicate != null) { | |||
| join.on(predicate); | |||
| } | |||
| } | |||
| } | |||
| // 没有join, 直接加条件 | |||
| else { | |||
| Predicate predicate = toCondition(desc.queryItem, value, cb, root.get(path)); | |||
| if (predicate != null) { | |||
| predicates.add(predicate); | |||
| } | |||
| } | |||
| }); | |||
| @@ -112,6 +114,62 @@ public class QueryBuilder { | |||
| }; | |||
| } | |||
| /** | |||
| * 转成条件 | |||
| * | |||
| * @param queryItem | |||
| * @param value | |||
| * @param cb | |||
| * @param expression | |||
| * @return | |||
| */ | |||
| private static Predicate toCondition(QueryItem queryItem, Object value, CriteriaBuilder cb, Expression expression) { | |||
| switch (queryItem.type()) { | |||
| case in: | |||
| CriteriaBuilder.In in = cb.in(expression); | |||
| List list = (List) value; | |||
| for (Object o : list) { | |||
| in.value(o); | |||
| } | |||
| return in; | |||
| case equal: | |||
| return cb.equal(expression, value); | |||
| case like: | |||
| return cb.like(expression, "%" + value + "%"); | |||
| case gt: | |||
| return cb.gt(expression, (Number) value); | |||
| case lt: | |||
| return cb.lt(expression, (Number) value); | |||
| case ge: | |||
| return cb.ge(expression, (Number) value); | |||
| case le: | |||
| return cb.le(expression, (Number) value); | |||
| case notEqual: | |||
| return cb.notEqual(expression, value); | |||
| case notLike: | |||
| return cb.notLike(expression, "%" + value + "%"); | |||
| case rightLike: | |||
| return cb.like(expression, value + "%"); | |||
| case betweenDate: | |||
| Date[] timeRange = (Date[]) value; | |||
| if (timeRange.length == 2) { | |||
| return cb.between(expression, timeRange[0], timeRange[1]); | |||
| } else { | |||
| log.warn("betweenDate 需要两个日期"); | |||
| } | |||
| case notNull: | |||
| if (Boolean.valueOf(value.toString())) { | |||
| return cb.isNotNull(expression); | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| /** | |||
| * @param field | |||
| * @param src | |||
| * @return | |||
| */ | |||
| private static Object getValue(Field field, Object src) { | |||
| try { | |||
| return field.get(src); | |||
| @@ -120,6 +178,10 @@ public class QueryBuilder { | |||
| } | |||
| } | |||
| /** | |||
| * @param clazz | |||
| * @return | |||
| */ | |||
| private static List<QueryDesc> getQueryDescMap(Class clazz) { | |||
| List<QueryDesc> queryDescs = classQueryDescMap.get(clazz); | |||
| if (queryDescs != null) { | |||
| @@ -147,6 +209,10 @@ public class QueryBuilder { | |||
| } | |||
| } | |||
| /** | |||
| * @param field | |||
| * @return | |||
| */ | |||
| private static QueryDesc getQueryDec(Field field) { | |||
| QueryItem annotation = field.getAnnotation(QueryItem.class); | |||
| if (annotation == null) { | |||
| @@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy; | |||
| import java.lang.annotation.Target; | |||
| /** | |||
| * Created by Tkk on 2018/7/21. | |||
| * on 2018/7/21. | |||
| */ | |||
| @Retention(RetentionPolicy.RUNTIME) | |||
| @Target(ElementType.FIELD) | |||
| @@ -21,10 +21,16 @@ public @interface QueryItem { | |||
| /** | |||
| * 查询条件 | |||
| * @return | |||
| */ | |||
| QueryType type() default QueryType.equal; | |||
| /** | |||
| * Join条件 | |||
| * @return | |||
| */ | |||
| QueryJoinType join() default QueryJoinType.None; | |||
| /** | |||
| * object是否可以为null | |||
| @@ -0,0 +1,12 @@ | |||
| package com.chilunyc.fumao.common.util.jpa.query; | |||
| /** | |||
| * on 2018/7/31. | |||
| */ | |||
| public enum QueryJoinType { | |||
| None, | |||
| Left, | |||
| Right, | |||
| Inner | |||
| } | |||
| @@ -1,7 +1,7 @@ | |||
| package com.chilunyc.fumao.common.util.jpa.query; | |||
| /** | |||
| * Created by Tkk on 2018/7/21. | |||
| * on 2018/7/21. | |||
| */ | |||
| public enum QueryType { | |||
| @@ -33,8 +33,7 @@ public enum QueryType { | |||
| notLike, | |||
| // | |||
| bwtween, | |||
| betweenDate, | |||
| ; | |||
| notNull, in; | |||
| } | |||
| @@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy; | |||
| import java.lang.annotation.Target; | |||
| /** | |||
| * Created by Tkk on 2018/7/21. | |||
| * on 2018/7/21. | |||
| */ | |||
| @Retention(RetentionPolicy.RUNTIME) | |||
| @Target(ElementType.TYPE) | |||
| @@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy; | |||
| import java.lang.annotation.Target; | |||
| /** | |||
| * Created by Tkk on 2018/7/21. | |||
| * on 2018/7/21. | |||
| */ | |||
| @Retention(RetentionPolicy.RUNTIME) | |||
| @Target(ElementType.TYPE) | |||
| @@ -4,7 +4,7 @@ | |||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
| <parent> | |||
| <artifactId>fumao</artifactId> | |||
| <groupId>com.aki</groupId> | |||
| <groupId>com.chilunyc</groupId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| @@ -14,7 +14,7 @@ | |||
| <dependencies> | |||
| <dependency> | |||
| <groupId>com.aki</groupId> | |||
| <groupId>com.chilunyc</groupId> | |||
| <artifactId>fumao-common</artifactId> | |||
| <version>0.0.1-SNAPSHOT</version> | |||
| </dependency> | |||