| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>MicroCommunity</artifactId> |
| | | <groupId>com.java110</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>Api</artifactId> |
| | | |
| | | <name>Api</name> |
| | | <!-- FIXME change it to the project's website --> |
| | | <url>http://www.example.com</url> |
| | | |
| | | <properties> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <maven.compiler.source>1.7</maven.compiler.source> |
| | | <maven.compiler.target>1.7</maven.compiler.target> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.java110</groupId> |
| | | <artifactId>java110-service</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.java110</groupId> |
| | | <artifactId>java110-config</artifactId> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | </dependency> |
| | | <!-- swagger-ui --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <version>4.11</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <finalName>Api</finalName> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-dependency-plugin</artifactId> |
| | | <version>2.10</version> |
| | | <executions> |
| | | <execution> |
| | | <id>unpack</id> |
| | | <phase>generate-resources</phase> |
| | | <goals> |
| | | <goal>unpack</goal> |
| | | </goals> |
| | | <configuration> |
| | | <artifactItems> |
| | | <artifactItem> |
| | | <groupId>com.java110</groupId> |
| | | <artifactId>java110-config</artifactId> |
| | | <version>${microcommunity.version}</version> |
| | | <type>jar</type> |
| | | <overWrite>true</overWrite> |
| | | <outputDirectory>${project.build.directory}/classes</outputDirectory> |
| | | </artifactItem> |
| | | </artifactItems> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <mainClass>com.java110.api.ApiApplicationStart</mainClass> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-javadoc-plugin</artifactId> |
| | | <version>2.10.4</version> |
| | | <configuration> |
| | | <aggregate>true</aggregate> |
| | | <reportOutputDirectory>../javadocs</reportOutputDirectory> |
| | | <destDir>security-javadoc</destDir> |
| | | <javadocExecutable>${java.home}bin/javadoc</javadocExecutable> |
| | | <tags> |
| | | <tag> |
| | | <name>Description</name> |
| | | <placement>a</placement> |
| | | <head>功能描述:</head> |
| | | </tag> |
| | | </tags> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
| New file |
| | |
| | | package com.java110.api; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.web.client.RestTemplateBuilder; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.cloud.client.loadbalancer.LoadBalanced; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | import java.nio.charset.Charset; |
| | | |
| | | |
| | | /** |
| | | * spring boot 初始化启动类 |
| | | * |
| | | * @version v0.1 |
| | | * @auther com.java110.wuxw |
| | | * @mail 928255095@qq.com |
| | | * @date 2016年8月6日 |
| | | * @tag |
| | | */ |
| | | @SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.api","com.java110.core","com.java110.event.center","com.java110.cache"}) |
| | | @EnableDiscoveryClient |
| | | |
| | | @EnableSwagger2 |
| | | //@EnableConfigurationProperties(EventProperties.class) |
| | | public class ApiApplicationStart { |
| | | |
| | | /** |
| | | * 实例化RestTemplate,通过@LoadBalanced注解开启均衡负载能力. |
| | | * @return restTemplate |
| | | */ |
| | | @Bean |
| | | @LoadBalanced |
| | | public RestTemplate restTemplate() { |
| | | StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8")); |
| | | RestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build(); |
| | | return restTemplate; |
| | | } |
| | | |
| | | /** |
| | | * 实例化RestTemplate |
| | | * @return restTemplate |
| | | */ |
| | | @Bean |
| | | public RestTemplate restTemplateNoLoadBalanced() { |
| | | StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8")); |
| | | RestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build(); |
| | | return restTemplate; |
| | | } |
| | | |
| | | @Bean |
| | | public Docket swaggerSpringMvcPlugin() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .paths(PathSelectors.any()) |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).build(); |
| | | } |
| | | |
| | | /** |
| | | * 创建该API的基本信息(这些基本信息会展现在文档页面中) |
| | | * 访问地址:http://项目实际地址/swagger-ui.html |
| | | * @return |
| | | */ |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("Swagger2构建RESTful APIs") |
| | | .description("api信息") |
| | | .termsOfServiceUrl("https://github.com/java110/MicroCommunity") |
| | | .contact("sunf") |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception{ |
| | | SpringApplication.run(ApiApplicationStart.class, args); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.java110.api.rest; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * |
| | | * rest api |
| | | * Created by wuxw on 2018/10/16. |
| | | */ |
| | | @RestController |
| | | |
| | | @Api(value = "Rest Api 用户服务") |
| | | @RequestMapping(path = "/rest") |
| | | public class RestApi { |
| | | |
| | | /** |
| | | * 健康检查 服务 |
| | | * @return |
| | | */ |
| | | @RequestMapping(path = "/health",method = RequestMethod.GET) |
| | | @ApiOperation(value="服务健康检查", notes="test: 返回 2XX 表示服务正常") |
| | | //@ApiImplicitParam(paramType="query", name = "userNumber", value = "用户编号", required = true, dataType = "Integer") |
| | | public String health(){ |
| | | return ""; |
| | | } |
| | | |
| | | @ApiOperation(value="保存用户信息", notes="test: res_code 为0000表示成功,其他表示失败") |
| | | @ApiImplicitParam(paramType="save", name = "info", value = "用户编号", required = true, dataType = "String") |
| | | @RequestMapping(path = "/saveUser",method = RequestMethod.PUT) |
| | | public String saveUser(@RequestParam("info") String info){ |
| | | return "{}"; |
| | | } |
| | | } |
| New file |
| | |
| | | jedis: |
| | | pool: |
| | | config: |
| | | maxTotal: 100 |
| | | maxIdle: 20 |
| | | maxWaitMillis: 20000 |
| | | host: 192.168.31.199 |
| | | port: 6379 |
| | | |
| | | eureka: |
| | | instance: |
| | | leaseRenewalIntervalInSeconds: 10 |
| | | leaseExpirationDurationInSeconds: 30 |
| | | client: |
| | | serviceUrl: |
| | | defaultZone: http://192.168.31.199:8761/eureka/ |
| | | #defaultZone: http://localhost:8761/eureka/ |
| | | server: |
| | | port: 8008 |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | |
| | | spring: |
| | | http: |
| | | encoding: |
| | | charset: UTF-8 |
| | | enabled: true |
| | | force: true |
| | | application: |
| | | name: api |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.31.199 |
| | | port: 6379 |
| | | pool: |
| | | max-active: 300 |
| | | max-wait: 10000 |
| | | max-idle: 100 |
| | | min-idle: 0 |
| | | timeout: 0 |
| | | |
| | | #============== kafka =================== |
| | | kafka: |
| | | consumer: |
| | | zookeeper: |
| | | connect: 192.168.31.199:2181 |
| | | servers: 192.168.31.199:9092 |
| | | enable: |
| | | auto: |
| | | commit: true |
| | | session: |
| | | timeout: 6000 |
| | | auto: |
| | | commit: |
| | | interval: 100 |
| | | offset: |
| | | reset: latest |
| | | topic: test |
| | | group: |
| | | id: notifyBusinessStatus |
| | | concurrency: 10 |
| | | |
| | | producer: |
| | | zookeeper: |
| | | connect: 192.168.31.199:2181 |
| | | servers: 192.168.31.199:9092 |
| | | retries: 0 |
| | | batch: |
| | | size: 4096 |
| | | linger: 1 |
| | | buffer: |
| | | memory: 40960 |
| New file |
| | |
| | | jedis: |
| | | pool: |
| | | config: |
| | | maxTotal: 100 |
| | | maxIdle: 20 |
| | | maxWaitMillis: 20000 |
| | | host: 135.192.86.200 |
| | | port: 6379 |
| | | |
| | | eureka: |
| | | instance: |
| | | leaseRenewalIntervalInSeconds: 10 |
| | | leaseExpirationDurationInSeconds: 30 |
| | | client: |
| | | serviceUrl: |
| | | defaultZone: http://135.192.86.200:8761/eureka/ |
| | | #defaultZone: http://localhost:8761/eureka/ |
| | | server: |
| | | port: 8008 |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | |
| | | spring: |
| | | http: |
| | | encoding: |
| | | charset: UTF-8 |
| | | enabled: true |
| | | force: true |
| | | application: |
| | | name: api |
| | | redis: |
| | | database: 0 |
| | | host: 135.192.86.200 |
| | | port: 6379 |
| | | pool: |
| | | max-active: 300 |
| | | max-wait: 10000 |
| | | max-idle: 100 |
| | | min-idle: 0 |
| | | timeout: 0 |
| | | |
| | | #============== kafka =================== |
| | | kafka: |
| | | consumer: |
| | | zookeeper: |
| | | connect: 135.192.86.200:2181 |
| | | servers: 135.192.86.200:9092 |
| | | enable: |
| | | auto: |
| | | commit: true |
| | | session: |
| | | timeout: 6000 |
| | | auto: |
| | | commit: |
| | | interval: 100 |
| | | offset: |
| | | reset: latest |
| | | topic: test |
| | | group: |
| | | id: notifyBusinessStatus |
| | | concurrency: 10 |
| | | |
| | | producer: |
| | | zookeeper: |
| | | connect: 135.192.86.200:2181 |
| | | servers: 135.192.86.200:9092 |
| | | retries: 0 |
| | | batch: |
| | | size: 4096 |
| | | linger: 1 |
| | | buffer: |
| | | memory: 40960 |
| New file |
| | |
| | | jedis: |
| | | pool: |
| | | config: |
| | | maxTotal: 100 |
| | | maxIdle: 20 |
| | | maxWaitMillis: 20000 |
| | | host: 135.192.86.200 |
| | | port: 6379 |
| | | |
| | | eureka: |
| | | instance: |
| | | leaseRenewalIntervalInSeconds: 10 |
| | | leaseExpirationDurationInSeconds: 30 |
| | | client: |
| | | serviceUrl: |
| | | defaultZone: http://135.192.86.200:8761/eureka/ |
| | | #defaultZone: http://localhost:8761/eureka/ |
| | | server: |
| | | port: 8008 |
| | | tomcat: |
| | | uri-encoding: UTF-8 |
| | | |
| | | spring: |
| | | http: |
| | | encoding: |
| | | charset: UTF-8 |
| | | enabled: true |
| | | force: true |
| | | application: |
| | | name: api |
| | | redis: |
| | | database: 0 |
| | | host: 135.192.86.200 |
| | | port: 6379 |
| | | pool: |
| | | max-active: 300 |
| | | max-wait: 10000 |
| | | max-idle: 100 |
| | | min-idle: 0 |
| | | timeout: 0 |
| | | |
| | | #============== kafka =================== |
| | | kafka: |
| | | consumer: |
| | | zookeeper: |
| | | connect: 135.192.86.200:2181 |
| | | servers: 135.192.86.200:9092 |
| | | enable: |
| | | auto: |
| | | commit: true |
| | | session: |
| | | timeout: 6000 |
| | | auto: |
| | | commit: |
| | | interval: 100 |
| | | offset: |
| | | reset: latest |
| | | topic: test |
| | | group: |
| | | id: notifyBusinessStatus |
| | | concurrency: 10 |
| | | |
| | | producer: |
| | | zookeeper: |
| | | connect: 135.192.86.200:2181 |
| | | servers: 135.192.86.200:9092 |
| | | retries: 0 |
| | | batch: |
| | | size: 4096 |
| | | linger: 1 |
| | | buffer: |
| | | memory: 40960 |
| New file |
| | |
| | | spring: |
| | | profiles: |
| | | active: prod |
| New file |
| | |
| | | ${AnsiColor.BRIGHT_RED} |
| | | __ ____ ____ _______ |
| | | |__|_____ ___ _______ /_ |/_ |\ _ \ |
| | | | |\__ \ \ \/ /\__ \ | | | |/ /_\ \ |
| | | | | / __ \_\ / / __ \_| | | |\ \_/ \ |
| | | /\__| |(____ / \_/ (____ /|___| |___| \_____ / |
| | | \______| \/ \/ \/ |
| | | _________ __ _________ .__ |
| | | \_ ___ \ ____ ____ _/ |_ ____ _______ / _____/ ____ _______ ___ __|__| ____ ____ |
| | | / \ \/ _/ __ \ / \\ __\_/ __ \\_ __ \\_____ \ _/ __ \\_ __ \\ \/ /| |_/ ___\_/ __ \ |
| | | \ \____\ ___/ | | \| | \ ___/ | | \// \\ ___/ | | \/ \ / | |\ \___\ ___/ |
| | | \______ / \___ >|___| /|__| \___ >|__| /_______ / \___ >|__| \_/ |__| \___ >\___ > |
| | | \/ \/ \/ \/ \/ \/ \/ \/ |
| | | |
| | | java110 CenterService starting, more information scan https://github.com/java110/MicroCommunity |
| New file |
| | |
| | | package com.java110; |
| | | |
| | | import static org.junit.Assert.assertTrue; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | /** |
| | | * Unit test for simple App. |
| | | */ |
| | | public class AppTest |
| | | { |
| | | /** |
| | | * Rigorous Test :-) |
| | | */ |
| | | @Test |
| | | public void shouldAnswerWithTrue() |
| | | { |
| | | assertTrue( true ); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public void updateStoreCerdentailsInstance(Map info) throws DAOException; |
| | | |
| | | |
| | | /** |
| | | * 商户成员加入信息 |
| | | * @param businessMemberStore 商户成员信息 封装 |
| | | * @throws DAOException 操作数据库异常 |
| | | */ |
| | | public void saveBusinessMemberStore(Map businessMemberStore) throws DAOException; |
| | | |
| | | /** |
| | | * 成员加入 保存信息至instance |
| | | * @param info |
| | | * @throws DAOException |
| | | */ |
| | | public void saveMemberStoreInstance(Map info) throws DAOException; |
| | | |
| | | /** |
| | | * 查询商户成员加入信息(business过程) |
| | | * 根据bId 查询商户信息 |
| | | * @param info bId 信息 |
| | | * @return 商户信息 |
| | | * @throws DAOException |
| | | */ |
| | | public Map getBusinessMemberStore(Map info) throws DAOException; |
| | | |
| | | /** |
| | | * 查询商户成员加入信息(instance过程) |
| | | * 根据bId 查询商户信息 |
| | | * @param info bId 信息 |
| | | * @return 商户信息 |
| | | * @throws DAOException |
| | | */ |
| | | public Map getMemberStore(Map info) throws DAOException; |
| | | |
| | | /** |
| | | * 修改商户成员加入信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException |
| | | */ |
| | | public void updateMemberStoreInstance(Map info) throws DAOException; |
| | | |
| | | } |
| | |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户证件信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 商户成员加入信息 |
| | | * @param businessMemberStore 商户成员信息 封装 |
| | | * @throws DAOException 操作数据库异常 |
| | | */ |
| | | public void saveBusinessMemberStore(Map businessMemberStore) throws DAOException{ |
| | | logger.debug("商户成员加入 入参 businessMemberStore : {}",businessMemberStore); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveBusinessMemberStore",businessMemberStore); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"商户成员加入失败:"+ JSONObject.toJSONString(businessMemberStore)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 成员加入 保存信息至instance |
| | | * @param info |
| | | * @throws DAOException |
| | | */ |
| | | @Override |
| | | public void saveMemberStoreInstance(Map info) throws DAOException { |
| | | logger.debug("商户成员加入Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.insert("storeServiceDaoImpl.saveMemberStoreInstance",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商户照片信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询商户成员加入信息(business过程) |
| | | * 根据bId 查询商户信息 |
| | | * @param info bId 信息 |
| | | * @return 商户信息 |
| | | * @throws DAOException |
| | | */ |
| | | public Map getBusinessMemberStore(Map info) throws DAOException{ |
| | | logger.debug("查询商户成员加入信息 入参 info : {}",info); |
| | | |
| | | List<Map> businessMemberStores = sqlSessionTemplate.selectList("storeServiceDaoImpl.getBusinessMemberStore",info); |
| | | if(businessMemberStores == null || businessMemberStores.size() == 0){ |
| | | return null; |
| | | } |
| | | if(businessMemberStores.size() >1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessMemberStore,"+ JSONObject.toJSONString(info)); |
| | | } |
| | | |
| | | return businessMemberStores.get(0); |
| | | } |
| | | |
| | | /** |
| | | * 查询商户成员加入信息(instance过程) |
| | | * 根据bId 查询商户信息 |
| | | * @param info bId 信息 |
| | | * @return 商户信息 |
| | | * @throws DAOException |
| | | */ |
| | | public Map getMemberStore(Map info) throws DAOException{ |
| | | logger.debug("查询商户成员加入信息 入参 info : {}",info); |
| | | |
| | | List<Map> memberStores = sqlSessionTemplate.selectList("storeServiceDaoImpl.getMemberStore",info); |
| | | if(memberStores == null || memberStores.size() == 0){ |
| | | return null; |
| | | } |
| | | if(memberStores.size() >1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getMemberStore,"+ JSONObject.toJSONString(info)); |
| | | } |
| | | |
| | | return memberStores.get(0); |
| | | } |
| | | /** |
| | | * 修改商户成员加入信息 |
| | | * @param info 修改信息 |
| | | * @throws DAOException |
| | | */ |
| | | public void updateMemberStoreInstance(Map info) throws DAOException{ |
| | | logger.debug("修改商户成员加入信息Instance 入参 info : {}",info); |
| | | |
| | | int saveFlag = sqlSessionTemplate.update("storeServiceDaoImpl.updateMemberStoreInstance",info); |
| | | |
| | | if(saveFlag < 1){ |
| | | throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商户成员加入信息Instance数据失败:"+ JSONObject.toJSONString(info)); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 刷新 businessMemberStore 数据 |
| | | * 主要将 数据库 中字段和 接口传递字段建立关系 |
| | | * @param businessMemberStore |
| | | */ |
| | | protected void flushBusinessMemberStore(Map businessMemberStore,String statusCd){ |
| | | businessMemberStore.put("newBId",businessMemberStore.get("b_id")); |
| | | businessMemberStore.put("storeId",businessMemberStore.get("store_id")); |
| | | businessMemberStore.put("memberStoreId",businessMemberStore.get("member_store_id")); |
| | | businessMemberStore.put("memberId",businessMemberStore.get("member_id")); |
| | | businessMemberStore.put("statusCd", statusCd); |
| | | } |
| | | |
| | | /** |
| | | * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中 |
| | | * @param businessStore 商户信息 |
| | | */ |
| | |
| | | currentStoreCerdentials.put("operate",StatusConstant.OPERATE_DEL); |
| | | getStoreServiceDaoImpl().saveBusinessStoreCerdentials(currentStoreCerdentials); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 当修改数据时,查询instance表中的数据 自动保存删除数据到business中 |
| | | * @param businessMemberStore 商户信息 |
| | | */ |
| | | protected void autoSaveDelBusinessMemberStore(Business business, JSONObject businessMemberStore){ |
| | | //自动插入DEL |
| | | Map info = new HashMap(); |
| | | info.put("memberStoreId",businessMemberStore.getString("memberStoreId")); |
| | | info.put("statusCd",StatusConstant.STATUS_CD_VALID); |
| | | Map currentMemberStore = getStoreServiceDaoImpl().getMemberStore(info); |
| | | if(currentMemberStore == null || currentMemberStore.isEmpty()){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"未找到需要修改数据信息,入参错误或数据有问题,请检查"+info); |
| | | } |
| | | currentMemberStore.put("bId",business.getbId()); |
| | | currentMemberStore.put("storeId",currentMemberStore.get("store_id")); |
| | | currentMemberStore.put("memberStoreId",currentMemberStore.get("member_store_id")); |
| | | currentMemberStore.put("memberId",currentMemberStore.get("member_id")); |
| | | currentMemberStore.put("operate",StatusConstant.OPERATE_DEL); |
| | | getStoreServiceDaoImpl().saveBusinessStoreInfo(currentMemberStore); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.store.listener; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.common.constant.ResponseConstant; |
| | | import com.java110.common.constant.ServiceCodeConstant; |
| | | import com.java110.common.constant.StatusConstant; |
| | | import com.java110.common.exception.ListenerExecuteException; |
| | | import com.java110.common.util.Assert; |
| | | import com.java110.common.util.DateUtil; |
| | | import com.java110.common.util.StringUtil; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.store.dao.IStoreServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 商户成员加入 侦听 |
| | | * |
| | | * businessMemberStore |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("memberJoinedStoreListener") |
| | | @Transactional |
| | | public class memberJoinedStoreListener extends AbstractStoreBusinessServiceDataFlowListener{ |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(memberJoinedStoreListener.class); |
| | | |
| | | @Autowired |
| | | IStoreServiceDao storeServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 5; |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeConstant.SERVICE_CODE_MEMBER_JOINED_STORE; |
| | | } |
| | | |
| | | /** |
| | | * 保存商户信息 business 表中 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | if(data.containsKey("businessMemberStore")){ |
| | | JSONObject businessMemberStore = data.getJSONObject("businessMemberStore"); |
| | | doBusinessMemberStore(business,businessMemberStore); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * business 数据转移到 instance |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Map info = new HashMap(); |
| | | info.put("bId",business.getbId()); |
| | | info.put("operate",StatusConstant.OPERATE_ADD); |
| | | |
| | | //商户信息 |
| | | Map businessMemberStore = storeServiceDaoImpl.getBusinessMemberStore(info); |
| | | if( businessMemberStore != null && !businessMemberStore.isEmpty()) { |
| | | storeServiceDaoImpl.saveMemberStoreInstance(info); |
| | | dataFlowContext.addParamOut("storeId",businessMemberStore.get("store_id")); |
| | | dataFlowContext.addParamOut("memberId",businessMemberStore.get("member_id")); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 撤单 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId",bId); |
| | | info.put("statusCd",StatusConstant.STATUS_CD_VALID); |
| | | Map paramIn = new HashMap(); |
| | | paramIn.put("bId",bId); |
| | | paramIn.put("statusCd",StatusConstant.STATUS_CD_INVALID); |
| | | //商户信息 |
| | | Map memberStore = storeServiceDaoImpl.getMemberStore(info); |
| | | if(memberStore != null && !memberStore.isEmpty()){ |
| | | paramIn.put("memberStoreId",memberStore.get("member_store_id").toString()); |
| | | storeServiceDaoImpl.updateMemberStoreInstance(paramIn); |
| | | dataFlowContext.addParamOut("memberStoreId",memberStore.get("member_store_id")); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理 businessMemberStore 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessMemberStore 商户成员节点 |
| | | */ |
| | | private void doBusinessMemberStore(Business business,JSONObject businessMemberStore){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessMemberStore,"storeId","businessMemberStore 节点下没有包含 storeId 节点"); |
| | | Assert.jsonObjectHaveKey(businessMemberStore,"memberId","businessMemberStore 节点下没有包含 memberId 节点"); |
| | | |
| | | if(businessMemberStore.getString("storeId").startsWith("-") || businessMemberStore.getString("memberId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"传入参数 storeId 或 storeId 必须是已有商户ID,"+businessMemberStore); |
| | | } |
| | | |
| | | if(businessMemberStore.getString("memberStoreId").startsWith("-")){ |
| | | //刷新缓存 |
| | | flushMemberStoreId(business.getDatas()); |
| | | } |
| | | |
| | | businessMemberStore.put("bId",business.getbId()); |
| | | businessMemberStore.put("operate", StatusConstant.OPERATE_ADD); |
| | | //保存商户信息 |
| | | storeServiceDaoImpl.saveBusinessMemberStore(businessMemberStore); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 刷新 商户ID |
| | | * @param data |
| | | */ |
| | | private void flushMemberStoreId(JSONObject data) { |
| | | |
| | | String memberStoreId = GenerateCodeFactory.getMemberStoreId(); |
| | | JSONObject businessMemberStore = data.getJSONObject("businessMemberStore"); |
| | | businessMemberStore.put("memberStoreId",memberStoreId); |
| | | |
| | | } |
| | | public IStoreServiceDao getStoreServiceDaoImpl() { |
| | | return storeServiceDaoImpl; |
| | | } |
| | | |
| | | public void setStoreServiceDaoImpl(IStoreServiceDao storeServiceDaoImpl) { |
| | | this.storeServiceDaoImpl = storeServiceDaoImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.store.listener; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.common.constant.ResponseConstant; |
| | | import com.java110.common.constant.ServiceCodeConstant; |
| | | import com.java110.common.constant.StatusConstant; |
| | | import com.java110.common.exception.ListenerExecuteException; |
| | | import com.java110.common.util.Assert; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.entity.center.Business; |
| | | import com.java110.store.dao.IStoreServiceDao; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 商户成员退出 侦听 |
| | | * |
| | | * 处理节点 |
| | | * 1、businessMemberStore:{} 商户基本信息节点 |
| | | * 协议地址 :https://github.com/java110/MicroCommunity/wiki/%E5%88%A0%E9%99%A4%E5%95%86%E6%88%B7%E4%BF%A1%E6%81%AF-%E5%8D%8F%E8%AE%AE |
| | | * Created by wuxw on 2018/5/18. |
| | | */ |
| | | @Java110Listener("memberQuitStoreListener") |
| | | @Transactional |
| | | public class memberQuitStoreListener extends AbstractStoreBusinessServiceDataFlowListener { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(memberQuitStoreListener.class); |
| | | @Autowired |
| | | IStoreServiceDao storeServiceDaoImpl; |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 6; |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeConstant.SERVICE_CODE_MEMBER_QUIT_STORE; |
| | | } |
| | | |
| | | /** |
| | | * 根据删除信息 查出Instance表中数据 保存至business表 (状态写DEL) 方便撤单时直接更新回去 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doSaveBusiness(DataFlowContext dataFlowContext, Business business) { |
| | | JSONObject data = business.getDatas(); |
| | | |
| | | Assert.notEmpty(data,"没有datas 节点,或没有子节点需要处理"); |
| | | |
| | | //处理 businessStore 节点 按理这里不应该处理,程序上支持,以防真有这种业务 |
| | | if(data.containsKey("businessMemberStore")){ |
| | | JSONObject memberStore = data.getJSONObject("businessMemberStore"); |
| | | doBusinessMemberStore(business,memberStore); |
| | | dataFlowContext.addParamOut("memberStoreId",memberStore.getString("memberStoreId")); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除 instance数据 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doBusinessToInstance(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | |
| | | //商户信息 |
| | | Map info = new HashMap(); |
| | | info.put("bId",business.getbId()); |
| | | info.put("operate",StatusConstant.OPERATE_DEL); |
| | | |
| | | //商户信息 |
| | | Map businessMemberStore = storeServiceDaoImpl.getBusinessMemberStore(info); |
| | | if( businessMemberStore != null && !businessMemberStore.isEmpty()) { |
| | | flushBusinessStoreInfo(businessMemberStore,StatusConstant.STATUS_CD_INVALID); |
| | | storeServiceDaoImpl.updateMemberStoreInstance(businessMemberStore); |
| | | dataFlowContext.addParamOut("memberStoreId",businessMemberStore.get("member_store_id")); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 撤单 |
| | | * 从business表中查询到DEL的数据 将instance中的数据更新回来 |
| | | * @param dataFlowContext 数据对象 |
| | | * @param business 当前业务对象 |
| | | */ |
| | | @Override |
| | | protected void doRecover(DataFlowContext dataFlowContext, Business business) { |
| | | String bId = business.getbId(); |
| | | //Assert.hasLength(bId,"请求报文中没有包含 bId"); |
| | | Map info = new HashMap(); |
| | | info.put("bId",bId); |
| | | info.put("statusCd",StatusConstant.STATUS_CD_INVALID); |
| | | |
| | | Map delInfo = new HashMap(); |
| | | delInfo.put("bId",business.getbId()); |
| | | delInfo.put("operate",StatusConstant.OPERATE_DEL); |
| | | //商户信息 |
| | | Map memberStore = storeServiceDaoImpl.getMemberStore(info); |
| | | if(memberStore != null && !memberStore.isEmpty()){ |
| | | |
| | | //商户信息 |
| | | Map businessMemberStore = storeServiceDaoImpl.getBusinessMemberStore(delInfo); |
| | | //除非程序出错了,这里不会为空 |
| | | if(businessMemberStore == null || businessMemberStore.isEmpty()){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_INNER_ERROR,"撤单失败(member store),程序内部异常,请检查! "+delInfo); |
| | | } |
| | | |
| | | flushBusinessStoreInfo(businessMemberStore,StatusConstant.STATUS_CD_VALID); |
| | | storeServiceDaoImpl.updateMemberStoreInstance(businessMemberStore); |
| | | dataFlowContext.addParamOut("memberStoreId",memberStore.get("member_store_id")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 处理 businessStore 节点 |
| | | * @param business 总的数据节点 |
| | | * @param businessStore 商户节点 |
| | | */ |
| | | private void doBusinessMemberStore(Business business,JSONObject businessStore){ |
| | | |
| | | Assert.jsonObjectHaveKey(businessStore,"memberStoreId","doBusinessMemberStore 节点下没有包含 memberStoreId 节点"); |
| | | |
| | | if(businessStore.getString("memberStoreId").startsWith("-")){ |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_PARAM_ERROR,"memberStoreId 错误,不能自动生成(必须已经存在的memberStoreId)"+businessStore); |
| | | } |
| | | //自动插入DEL |
| | | autoSaveDelBusinessMemberStore(business,businessStore); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public IStoreServiceDao getStoreServiceDaoImpl() { |
| | | return storeServiceDaoImpl; |
| | | } |
| | | |
| | | public void setStoreServiceDaoImpl(IStoreServiceDao storeServiceDaoImpl) { |
| | | this.storeServiceDaoImpl = storeServiceDaoImpl; |
| | | } |
| | | } |
| | |
| | | public static final String SERVICE_CODE_DELETE_STORE_INFO = "delete.store.info"; |
| | | |
| | | |
| | | /** |
| | | * 商户成员加入信息 |
| | | */ |
| | | public static final String SERVICE_CODE_MEMBER_JOINED_STORE = "member.joined.store"; |
| | | |
| | | /** |
| | | * 商户成员退出信息 |
| | | */ |
| | | public static final String SERVICE_CODE_MEMBER_QUIT_STORE = "member.quit.store"; |
| | | |
| | | /** |
| | | * 保存商品信息 |
| | |
| | | INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id) |
| | | VALUES('delete.store.info','D','删除商户信息',1,'http://store-service/storeApi/service','8000418003'); |
| | | |
| | | INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id) |
| | | VALUES('member.joined.store','D','商户成员加入',1,'http://store-service/storeApi/service','8000418003'); |
| | | |
| | | INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id) |
| | | VALUES('member.quit.store','D','商户成员退出',1,'http://store-service/storeApi/service','8000418003'); |
| | | |
| | | |
| | | INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id) |
| | | VALUES('transfer.console.menu','T','透传菜单查询',1,'http://192.168.31.199:8001/userApi/service','8000418001'); |
| | |
| | | INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id) |
| | | VALUES('delete.comment.info','D','删除评论',1,'http://comment-service/commentApi/service','8000418003'); |
| | | |
| | | INSERT INTO c_service(service_code,business_type_cd,`name`,seq,url,provide_app_id) |
| | | VALUES('delete.comment.info','D','删除评论',1,'http://comment-service/commentApi/service','8000418003'); |
| | | |
| | | |
| | | insert into c_route(app_id,service_id,invoke_model,order_type_cd,status_cd) values( |
| | | '8000418001','1','S','Q','0' |
| | |
| | | CREATE INDEX idx_business_store_cerdentials_store_id ON business_store_cerdentials(store_id); |
| | | CREATE INDEX idx_business_store_cerdentials_b_id ON business_store_cerdentials(b_id); |
| | | |
| | | -- 商户成员 |
| | | create table business_member_store( |
| | | member_store_id varchar(30) not null comment 'ID', |
| | | b_id VARCHAR(30) NOT NULL COMMENT '业务Id', |
| | | store_id VARCHAR(30) NOT NULL COMMENT '商店ID', |
| | | member_id varchar(50) not null comment '商户成员ID', |
| | | `month` INT NOT NULL comment '月份', |
| | | create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | operate VARCHAR(3) NOT NULL COMMENT '数据状态,添加ADD,修改MOD 删除DEL' |
| | | ) |
| | | partition BY RANGE (`month`) ( |
| | | partition business_member_store_1 VALUES LESS THAN (2), |
| | | partition business_member_store_2 VALUES LESS THAN (3), |
| | | partition business_member_store_3 VALUES LESS THAN (4), |
| | | partition business_member_store_4 VALUES LESS THAN (5), |
| | | partition business_member_store_5 VALUES LESS THAN (6), |
| | | partition business_member_store_6 VALUES LESS THAN (7), |
| | | partition business_member_store_7 VALUES LESS THAN (8), |
| | | partition business_member_store_8 VALUES LESS THAN (9), |
| | | partition business_member_store_9 VALUES LESS THAN (10), |
| | | partition business_member_store_10 VALUES LESS THAN (11), |
| | | partition business_member_store_11 VALUES LESS THAN (12), |
| | | partition business_member_store_12 VALUES LESS THAN (13) |
| | | ); |
| | | CREATE INDEX idx_business_member_store_store_id ON business_member_store(store_id); |
| | | CREATE INDEX idx_business_member_store_b_id ON business_member_store(b_id); |
| | | |
| | | |
| | | |
| | | CREATE TABLE s_store( |
| | |
| | | CREATE INDEX idx_store_cerdentials_store_id ON s_store_cerdentials(store_id); |
| | | CREATE INDEX idx_store_cerdentials_store_cerdentials_id ON s_store_cerdentials(store_cerdentials_id); |
| | | |
| | | -- 商户成员 |
| | | create table s_member_store( |
| | | member_store_id varchar(30) not null comment 'ID', |
| | | b_id VARCHAR(30) NOT NULL COMMENT '业务Id', |
| | | store_id VARCHAR(30) NOT NULL COMMENT '商店ID', |
| | | member_id varchar(50) not null comment '商户成员ID', |
| | | create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | status_cd VARCHAR(2) NOT NULL default '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效', |
| | | unique KEY (member_store_id) |
| | | ) |
| | | CREATE INDEX idx_s_member_store_store_id ON s_member_store(store_id); |
| | | CREATE INDEX idx_s_member_store_b_id ON s_member_store(b_id); |
| | | |
| | | -- 店铺种类 |
| | | create table store_type( |
| | | id INT NOT NULL AUTO_INCREMENT KEY COMMENT 'id', |
| | | domain varchar(20) not null comment '域', |
| | | store_type_cd VARCHAR(12) NOT NULL COMMENT '店铺编码', |
| | | `name` VARCHAR(50) NOT NULL COMMENT '店铺种类编码', |
| | | description VARCHAR(200) COMMENT '描述', |
| | | create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | unique KEY (store_type_cd) |
| | | ); |
| | | |
| | | insert into store_type(domain,store_type_cd,name,description) values('CORE_STROE','870000000001','小区','小区'); |
| | | insert into store_type(domain,store_type_cd,name,description) values('CORE_STROE','870000000002','物业','物业'); |
| | | insert into store_type(domain,store_type_cd,name,description) values('CORE_STROE','870000000003','物流公司','物流公司'); |
| | | insert into store_type(domain,store_type_cd,name,description) values('APP_VIEW','870181027001','饭店','饭店'); |
| | | insert into store_type(domain,store_type_cd,name,description) values('APP_VIEW','870181027002','餐厅','餐厅'); |
| | | insert into store_type(domain,store_type_cd,name,description) values('APP_VIEW','870181027003','火锅店','火锅店'); |
| | | insert into store_type(domain,store_type_cd,name,description) values('APP_VIEW','870181027004','超市','超市'); |
| | |
| | | and sc.store_cerdentials_id = #{storeCerdentialsId} |
| | | </if> |
| | | </update> |
| | | |
| | | <!--商户成员加入 add by wuxw 2018-10-27 saveBusinessMemberStore--> |
| | | <insert id="saveBusinessMemberStore" parameterType="Map"> |
| | | insert into business_member_store(member_store_id,b_id,store_id,member_id,month,operate) |
| | | values(#{memberStoreId},#{bId},#{storeId},#{memberId},#{month},#{operate}) |
| | | </insert> |
| | | |
| | | <!-- 商户成员加入 instance表中 add by wuxw 2018-10-27 --> |
| | | <insert id="saveMemberStoreInstance" parameterType="Map"> |
| | | insert into s_member_store(member_store_id,b_id,store_id,member_id,status_cd) |
| | | select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,'0' |
| | | from business_member_store ms where |
| | | ms.operate = 'ADD' and ms.b_id=#{bId} |
| | | </insert> |
| | | |
| | | <!-- 查询商户成员 add by wuxw 2018-10-27 getBusinessMemberStore--> |
| | | <select id="getBusinessMemberStore" parameterType="Map" resultType="Map"> |
| | | select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,ms.operate |
| | | from business_member_store ms where 1 = 1 |
| | | <if test="operate != null and operate != ''"> |
| | | and ms.operate = #{operate} |
| | | </if> |
| | | <if test="bId != null and bId !=''"> |
| | | and ms.b_id = #{bId} |
| | | </if> |
| | | <if test="storeId != null and storeId != ''"> |
| | | and ms.store_id = #{storeId} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <!-- 查询商户成员 add by wuxw 2018-07-03 --> |
| | | <select id="getMemberStore" parameterType="Map" resultType="Map"> |
| | | select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,ms.status_cd |
| | | from business_member_store ms |
| | | where 1=1 |
| | | <if test="statusCd != null and statusCd != ''"> |
| | | and ms.status_cd = #{statusCd} |
| | | </if> |
| | | |
| | | <if test="bId != null and bId !=''"> |
| | | and ms.b_id = #{bId} |
| | | </if> |
| | | <if test="storeId != null and storeId !=''"> |
| | | and ms.member_store_id = #{memberStoreId} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 修改商户成员 add by wuxw 2018-07-03 --> |
| | | <update id="updateMemberStoreInstance" parameterType="Map"> |
| | | update s_member_store ms set ms.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,ms.b_id = #{newBId} |
| | | </if> |
| | | where 1=1 |
| | | <if test="bId != null and bId !=''"> |
| | | and ms.b_id = #{bId} |
| | | </if> |
| | | <if test="memberStoreId != null and memberStoreId !=''"> |
| | | and ms.member_store_id = #{memberStoreId} |
| | | </if> |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | prefixMap.put("storeId","40"); |
| | | prefixMap.put("storePhotoId","41"); |
| | | prefixMap.put("storeCerdentialsId","42"); |
| | | prefixMap.put("memberStoreId","43"); |
| | | prefixMap.put("shopId","50"); |
| | | prefixMap.put("shopAttrId","51"); |
| | | prefixMap.put("shopPhotoId","52"); |
| | |
| | | prefixMap.put("subCommentAttrId","62"); |
| | | prefixMap.put("commentPhotoId","63"); |
| | | prefixMap.put("commentScoreId","64"); |
| | | prefixMap.put("communityId","70"); |
| | | prefixMap.put("communityPhotoId","71"); |
| | | } |
| | | |
| | | private static String PLATFORM_CODE = "0001"; |
| | |
| | | return getCode(prefixMap.get("storeId")); |
| | | } |
| | | |
| | | public static String getMemberStoreId() throws GenerateCodeException{ |
| | | if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){ |
| | | return prefixMap.get("memberStoreId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d"); |
| | | } |
| | | //调用服务 |
| | | return getCode(prefixMap.get("memberStoreId")); |
| | | } |
| | | |
| | | |
| | | public static String getStorePhotoId() throws GenerateCodeException{ |
| | | if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){ |
| | |
| | | return getCode(prefixMap.get("storeCerdentialsId")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取小区ID |
| | | * @return |
| | | * @throws GenerateCodeException |
| | | */ |
| | | public static String getCommunityId() throws GenerateCodeException{ |
| | | if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){ |
| | | return prefixMap.get("communityId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d"); |
| | | } |
| | | //调用服务 |
| | | return getCode(prefixMap.get("communityId")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取小区照片ID |
| | | * @return |
| | | * @throws GenerateCodeException |
| | | */ |
| | | public static String getCommunityPhotoId() throws GenerateCodeException{ |
| | | if(!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))){ |
| | | return prefixMap.get("communityPhotoId") +DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H)+ nextId("%06d"); |
| | | } |
| | | //调用服务 |
| | | return getCode(prefixMap.get("communityPhotoId")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 商品ID生成 |
| | | * @return |
| | |
| | | <module>zipkin</module> |
| | | <module>ShopService</module> |
| | | <module>CommentService</module> |
| | | <module>Api</module> |
| | | </modules> |
| | | |
| | | <parent> |
| | |
| | | <httpclient.verion>3.1</httpclient.verion> |
| | | <spring.version>4.3.2.RELEASE</spring.version> |
| | | <zookeeper.version>3.3.6</zookeeper.version> |
| | | <swagger.version>2.5.0</swagger.version> |
| | | </properties> |
| | | |
| | | <dependencyManagement> |
| | |
| | | <version>${zookeeper.version}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>${swagger.version}</version> |
| | | </dependency> |
| | | <!-- swagger-ui --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>${swagger.version}</version> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |