فهرست منبع

init from phab

xielq 4 سال پیش
والد
کامیت
52e308576e

+ 25 - 0
build.gradle

@@ -0,0 +1,25 @@
+apply from: "$rootDir/gradle/service-base.gradle"
+/*apply from: "$rootDir/gradle/publish.gradle"
+apply from: "$rootDir/gradle/docker.gradle"*/
+
+group 'com.uas.cloud.mall'
+version '0.1.3'
+
+ext {
+    baseName = 'mall-carousel-service'
+    artifactId = 'mall-carousel-service'
+}
+
+jar {
+    baseName = "${baseName}"
+    version = "${version}"
+}
+
+dependencies {
+ 	compile "org.springframework.boot:spring-boot-starter-data-jpa"
+    compile "mysql:mysql-connector-java:5.1.21"
+    compile "org.springframework.cloud:spring-cloud-starter-eureka"
+    compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
+
+    compile "com.uas.cloud.base.commons:common:0.1.0"
+}

+ 1 - 0
gradle.properties

@@ -0,0 +1 @@
+hibernateValidatorVersion=5.4.0.Final

+ 40 - 0
gradle/docker.gradle

@@ -0,0 +1,40 @@
+buildscript {
+    ext {
+        springBootVersion = '1.4.4.RELEASE'
+    }
+    repositories {
+        maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
+        mavenCentral()
+        jcenter()
+    }
+    dependencies {
+        classpath('se.transmode.gradle:gradle-docker:1.2')
+    }
+}
+
+// apply plugin: 'docker'
+apply plugin: se.transmode.gradle.plugins.docker.DockerPlugin
+
+// 这里产生的镜像的标签会和 project。group一样,暂未找到解决办法
+// tag = "${project.group}/${applicationName}:${tagVersion}"
+task buildDocker(type:Docker, dependsOn: build) {
+    push = true
+//    applicationName = jar.baseName
+
+    tag = "10.10.100.200:5000/${jar.baseName}"
+    dockerfile = file('src/main/docker/Dockerfile')
+    doFirst {
+        copy {
+            from jar
+            into stageDir
+        }
+    }
+}
+
+docker {
+    hostUrl 'https://192.168.99.100:2376' // set the URL used to contact the Docker server. Defaults to http://localhost:2375
+    dockerBinary 'C:\\Program Files\\Docker Toolbox\\docker.exe'
+    useApi false // Use the Docker Remote API instead of a locally installed docker binary.
+    maintainer  'yangck'// The name and email address of the image maintainer.
+    registry '10.10.100.200:5000' // The hostname and port of the Docker image registry unless the Docker Hub Registry is used.
+}

+ 78 - 0
gradle/publish.gradle

@@ -0,0 +1,78 @@
+task sourcesJar(type: Jar) {
+    baseName "${baseName}"
+    classifier 'sources'
+    from sourceSets.main.allSource
+}
+artifacts {
+    archives sourcesJar
+}
+
+apply plugin: 'distribution'
+
+distributions {
+    main {
+        baseName = archivesBaseName
+
+        contents {
+            from { libsDir }
+        }
+    }
+
+    docs {
+        baseName = "$archivesBaseName-docs"
+
+        contents {
+            from(libsDir) {
+                include sourcesJar.archiveName
+            }
+        }
+    }
+}
+
+ext {
+    artifactoryBaseUrl = 'http://113.105.74.141:8081/artifactory'
+    artifactorySnapshotRepoUrl = "$artifactoryBaseUrl/libs-snapshot-local"
+    artifactoryReleaseRepoUrl = "$artifactoryBaseUrl/libs-release-local"
+}
+
+apply plugin: 'maven-publish'
+
+publishing {
+    publications {
+        plugin(MavenPublication) {
+            from components.java
+            artifactId "${artifactId}"
+
+            pom.withXml {
+                def root = asNode()
+                root.appendNode('name', "${baseName}")
+                root.appendNode('description', '商城轮播服务')
+                root.appendNode('inceptionYear', '2017')
+
+                def developer = root.appendNode('developers').appendNode('developer')
+                developer.appendNode('id', 'yangck')
+                developer.appendNode('name', '杨朝坤')
+                developer.appendNode('email', 'yangck@usoftchina.com')
+            }
+
+            artifact sourcesJar
+        }
+    }
+
+    repositories {
+        maven {
+            name 'myLocal'
+            url "file://$projectDir/repo"
+        }
+
+        maven {
+            name 'remoteArtifactory'
+            url project.version.endsWith('-SNAPSHOT') ? artifactorySnapshotRepoUrl : artifactoryReleaseRepoUrl
+
+            credentials {
+                username = 'yingp'
+                password = '111111'
+            }
+        }
+    }
+}

+ 74 - 0
gradle/service-base.gradle

@@ -0,0 +1,74 @@
+buildscript {
+    ext {
+        springBootVersion = '1.4.4.RELEASE'
+    }
+    repositories {
+        maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
+        maven { url "https://plugins.gradle.org/m2/" }
+        maven { url "https://repo.spring.io/libs-release" }
+        mavenCentral()
+        jcenter()
+    }
+    dependencies {
+        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+    }
+}
+
+apply plugin: 'idea'
+apply plugin: 'eclipse'
+apply plugin: 'maven'
+apply plugin: 'java'
+//apply plugin: 'spring-boot'
+apply plugin: org.springframework.boot.gradle.plugin.SpringBootPlugin // applying a plugin by plugin id is not supported in script plugins. You must use the plugin's fully qualified class name.
+sourceCompatibility = 1.8 // 必须在apply java插件之后
+targetCompatibility = 1.8
+
+bootRun {
+    addResources = true
+}
+idea {
+    module {
+        downloadSources = true
+        downloadJavadoc = false
+        inheritOutputDirs = false
+        outputDir = file("$buildDir/classes/main/")
+    }
+}
+
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            repository(url: "http://10.10.101.21:8081/artifactory/libs-release-local") {
+                authentication(userName: "yingp", password: "111111")
+            }
+        }
+    }
+}.dependsOn build
+
+repositories {
+    mavenLocal()
+    maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
+    maven {
+        url 'http://10.10.101.21:8081/artifactory/libs-release'
+    }
+    maven {
+        url 'http://10.10.101.21:8081/artifactory/libs-snapshot'
+    }
+    maven {
+        url 'http://10.10.101.21:8081/artifactory/plugins-snapshot'
+    }
+    mavenCentral()
+}
+
+dependencyManagement {
+    imports {
+        mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Camden.SR5'
+    }
+}
+dependencies {
+    testCompile 'org.springframework.boot:spring-boot-starter-test'
+    compile 'org.springframework.cloud:spring-cloud-starter-config'
+    // compile("org.springframework.boot:spring-boot-devtools")
+    compile "org.springframework.cloud:spring-cloud-starter-eureka"
+
+}

+ 2 - 0
settings.gradle

@@ -0,0 +1,2 @@
+rootProject.name = 'mall-carousel-service'
+

+ 6 - 0
src/main/docker/Dockerfile

@@ -0,0 +1,6 @@
+FROM frolvlad/alpine-oraclejdk8:slim
+VOLUME /tmp # reate a temporary file on my host under "/var/lib/docker" and link it to the container under "/tmp".
+ADD mall-carousel-service-0.1.3.jar app.jar
+RUN sh -c "touch /app.jar" #  "touch" the jar file so that it has a file modification time (Docker creates all container files in an "unmodified" state by default). This actually isn’t important for the simple app that we wrote, but any static content (e.g. "index.html") would require the file to have a modification time.
+ENV JAVA_OPTS=""
+ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar --spring.profiles.active=test"] # To reduce Tomcat startup time we added a system property pointing to "/dev/urandom" as a source of entropy.

+ 19 - 0
src/main/java/com/uas/cloud/mall/carousel/CarouselApplication.java

@@ -0,0 +1,19 @@
+package com.uas.cloud.mall.carousel;
+
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+/**
+ * 轮播服务
+ *
+ * @author yangck
+ * @create 2017-02-16 10:14
+ */
+@EnableDiscoveryClient
+@SpringBootApplication
+public class CarouselApplication {
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(CarouselApplication.class).web(true).run(args);
+    }
+}

+ 107 - 0
src/main/java/com/uas/cloud/mall/carousel/api/CarouselController.java

@@ -0,0 +1,107 @@
+package com.uas.cloud.mall.carousel.api;
+
+import com.uas.cloud.base.commons.common.api.ResourceNotFoundException;
+import com.uas.cloud.base.commons.common.api.ServiceError;
+import com.uas.cloud.mall.carousel.domain.Carousel;
+import com.uas.cloud.mall.carousel.service.CarouselService;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.client.ServiceInstance;
+import org.springframework.cloud.client.discovery.DiscoveryClient;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.util.UriComponentsBuilder;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * 轮播服务API
+ *
+ * @author yangck
+ * @create 2017-02-16 10:41
+ */
+@RestController
+@RequestMapping("/carousels")
+public class CarouselController {
+
+    private final Logger logger = LogManager.getLogger(getClass());
+
+    @Autowired
+    private DiscoveryClient client;
+
+    @Autowired
+    private CarouselService carouselService;
+
+    @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json")
+    public Carousel get(@PathVariable Long id) {
+        ServiceInstance instance = client.getLocalServiceInstance();
+        logger.info("/carousels, method: get, host:" + instance.getHost() + ", serviceId:" + instance.getServiceId() + ",carousel: " + id);
+        Carousel carousel = carouselService.findOne(id);
+        return carousel;
+    }
+
+    @RequestMapping(method = RequestMethod.POST, consumes = "application/json")
+    @ResponseStatus(HttpStatus.CREATED)
+    public ResponseEntity<Carousel> save(@RequestBody Carousel carousel, UriComponentsBuilder ucb) {
+        ServiceInstance instance = client.getLocalServiceInstance();
+        logger.info("/carousel, method: post, host: " + instance.getHost() + ", serviceId: " + instance.getServiceId() + "usedFor: " + carousel.getUsedFor());
+
+        Carousel saved = carouselService.save(carousel);
+
+        HttpHeaders headers = new HttpHeaders();
+        URI locationUri = ucb.path("/carousel")
+                .path(String.valueOf(carousel.getId()))
+                .build()
+                .toUri();
+        headers.setLocation(locationUri);
+
+        ResponseEntity<Carousel> responseEntity = new ResponseEntity<>(saved, headers, HttpStatus.CREATED);
+        return responseEntity;
+    }
+
+    @RequestMapping(method = RequestMethod.PUT, consumes = "application/json")
+    @ResponseStatus(HttpStatus.OK)
+    public ResponseEntity<Carousel> update(@RequestBody Carousel carousel) {
+        ServiceInstance instance = client.getLocalServiceInstance();
+        logger.info("/carousel, method: put, host: " + instance.getHost() + ", serviceId: " + instance.getServiceId() + "usedFor: " + carousel.getUsedFor());
+
+        Carousel saved = carouselService.save(carousel);
+
+        ResponseEntity<Carousel> responseEntity = new ResponseEntity<>(saved, HttpStatus.OK);
+        return responseEntity;
+    }
+
+
+    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+    public void delete(@PathVariable Long id) {
+        ServiceInstance instance = client.getLocalServiceInstance();
+        logger.info("/carousels, method: delete, host:" + instance.getHost() + ", serviceId:" + instance.getServiceId() + ",carousel: " + id);
+        carouselService.delete(id);
+    }
+
+    @RequestMapping(method = RequestMethod.GET, produces = "application/json")
+    public List<Carousel> carousels(@RequestParam(value = "usedFor", defaultValue = "home") String usedFor) {
+        ServiceInstance instance = client.getLocalServiceInstance();
+        logger.info("/carousel, get, host:" + instance.getHost() + ", serviceId:" + instance.getServiceId() + ",usedFor: " + usedFor);
+        List<Carousel> carousels = carouselService.findByUsedFor(usedFor);
+        return carousels;
+    }
+
+    @GetMapping(value = "/usedFor", produces = "application/json")
+    public List<String> getUsedFor() {
+        ServiceInstance instance = client.getLocalServiceInstance();
+        logger.info("/carousel/usedFor, get, host:" + instance.getHost() + ", serviceId:" + instance.getServiceId());
+        return carouselService.getUsedFor();
+    }
+
+    @ExceptionHandler(ResourceNotFoundException.class)
+    @ResponseStatus(HttpStatus.NOT_FOUND)
+    public ServiceError resourceNotFound(ResourceNotFoundException e) {
+        Long resourceId = e.getResourceId();
+        return new ServiceError(4, "Carousel [" + resourceId + "] not found");
+    }
+}

+ 26 - 0
src/main/java/com/uas/cloud/mall/carousel/data/CarouselRepository.java

@@ -0,0 +1,26 @@
+package com.uas.cloud.mall.carousel.data;
+
+import com.uas.cloud.mall.carousel.domain.Carousel;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 轮播服务数据访问
+ *
+ * @author yangck
+ * @create 2017-02-16 10:42
+ */
+@Repository
+public interface CarouselRepository extends JpaRepository<Carousel, Long> {
+
+    List<Carousel> findByUsedForOrderByOrderNumber(String usedFor);
+
+    Carousel save(Carousel carousel);
+
+    //@Query("select usedFor from Carousel group by usedFor")
+    @Query("select DISTINCT c.usedFor from Carousel c")
+    List<String> getUsedFor();
+}

+ 153 - 0
src/main/java/com/uas/cloud/mall/carousel/domain/Carousel.java

@@ -0,0 +1,153 @@
+package com.uas.cloud.mall.carousel.domain;
+
+import javax.persistence.*;
+import java.util.Map;
+
+/**
+ * 轮播
+ *
+ * @author yangck
+ * @create 2017-02-16 10:20
+ */
+@Entity(name = "Carousel")
+public class Carousel {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    /**
+     * 用于哪个应用
+     */
+    private String usedFor;
+
+    /**
+     * 排序数字
+     */
+    private Long orderNumber;
+
+    /**
+     * 图片url
+     * 主要是获取其它域名的图片
+     */
+    private String pictureUrl;
+
+    /**
+     * 链接URI
+     * 根据上下文拼接完整url
+     */
+    private String pictureUri;
+
+    /**
+     * 链接地址
+     * 主要是跳到其它域名
+     */
+    private String hrefUrl;
+
+    /**
+     * 链接URI
+     * 根据上下文拼接完整url
+     */
+    private String hrefUri;
+
+    /**
+     * 元数据.如轮播图对应的背景颜色属性<br/>
+     * 用于存储未知的额外数据
+     */
+    @ElementCollection(fetch = FetchType.EAGER)
+    @CollectionTable(name = "carousel_metadata", joinColumns = {
+        @JoinColumn(name = "carousel_id", referencedColumnName = "id")
+    })
+    private Map<String, String> metadata;
+
+    public Carousel() {
+    }
+
+    /**
+     * 主要内容
+     */
+    private String body;
+
+    public Carousel(Long id, String usedFor, Long orderNumber, String pictureUrl, String pictureUri, String hrefUrl, String hrefUri, String body) {
+        this.id = id;
+        this.usedFor = usedFor;
+        this.orderNumber = orderNumber;
+        this.pictureUrl = pictureUrl;
+        this.pictureUri = pictureUri;
+        this.hrefUrl = hrefUrl;
+        this.hrefUri = hrefUri;
+        this.body = body;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getUsedFor() {
+        return usedFor;
+    }
+
+    public void setUsedFor(String usedFor) {
+        this.usedFor = usedFor;
+    }
+
+    public Long getOrderNumber() {
+        return orderNumber;
+    }
+
+    public void setOrderNumber(Long orderNumber) {
+        this.orderNumber = orderNumber;
+    }
+
+    public String getPictureUrl() {
+        return pictureUrl;
+    }
+
+    public void setPictureUrl(String pictureUrl) {
+        this.pictureUrl = pictureUrl;
+    }
+
+    public String getPictureUri() {
+        return pictureUri;
+    }
+
+    public void setPictureUri(String pictureUri) {
+        this.pictureUri = pictureUri;
+    }
+
+    public String getHrefUrl() {
+        return hrefUrl;
+    }
+
+    public void setHrefUrl(String hrefUrl) {
+        this.hrefUrl = hrefUrl;
+    }
+
+    public String getHrefUri() {
+        return hrefUri;
+    }
+
+    public void setHrefUri(String hrefUri) {
+        this.hrefUri = hrefUri;
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public void setBody(String body) {
+        this.body = body;
+    }
+
+    public Map<String, String> getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(Map<String, String> metadata) {
+        this.metadata = metadata;
+    }
+}

+ 31 - 0
src/main/java/com/uas/cloud/mall/carousel/service/CarouselService.java

@@ -0,0 +1,31 @@
+package com.uas.cloud.mall.carousel.service;
+
+import com.uas.cloud.mall.carousel.domain.Carousel;
+
+import java.util.List;
+
+/**
+ * 轮播服务接口
+ *
+ * @author yangck
+ * @create 2017-02-16 10:16
+ */
+public interface CarouselService {
+
+    List<Carousel> findByUsedFor(String usedFor);
+
+    Carousel findOne(Long id);
+
+    Carousel save(Carousel carousel);
+
+    void delete(Long id);
+
+    void deleteAll();
+
+    /**
+     * 获取所有使用轮播的项目
+     * @return
+     */
+    List<String> getUsedFor();
+
+}

+ 52 - 0
src/main/java/com/uas/cloud/mall/carousel/service/impl/CarouselServiceImpl.java

@@ -0,0 +1,52 @@
+package com.uas.cloud.mall.carousel.service.impl;
+
+import com.uas.cloud.mall.carousel.data.CarouselRepository;
+import com.uas.cloud.mall.carousel.domain.Carousel;
+import com.uas.cloud.mall.carousel.service.CarouselService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 轮播服务Spring Data JPA实现
+ *
+ * @author yangck
+ * @create 2017-02-16 10:40
+ */
+@Service
+public class CarouselServiceImpl implements CarouselService {
+
+    @Autowired
+    private CarouselRepository carouselRepository;
+
+    @Override
+    public List<Carousel> findByUsedFor(String usedFor) {
+        return carouselRepository.findByUsedForOrderByOrderNumber(usedFor);
+    }
+
+    @Override
+    public Carousel findOne(Long id) {
+        return carouselRepository.findOne(id);
+    }
+
+    @Override
+    public Carousel save(Carousel carousel) {
+        return carouselRepository.save(carousel);
+    }
+
+    @Override
+    public void delete(Long id) {
+        carouselRepository.delete(id);
+    }
+
+    @Override
+    public void deleteAll() {
+        carouselRepository.deleteAll();
+    }
+
+    @Override
+    public List<String> getUsedFor() {
+        return carouselRepository.getUsedFor();
+    }
+}

+ 21 - 0
src/main/resources/application-dev.yml

@@ -0,0 +1,21 @@
+spring:
+  jpa:
+#    hibernate:
+#      ddl-auto:
+#        create-drop
+    properties:
+      hibernate:
+        hbm2ddl:
+          auto: update
+    # disable open EntityManager in View
+    open-in-view: false
+  datasource:
+    url: jdbc:mysql://10.10.100.18:3306/mall_home?useUnicode=true&characterEncoding=utf-8
+    username: root
+    password: select
+    driver-class-name: com.mysql.jdbc.Driver
+
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://10.10.100.23:28000/eureka/

+ 26 - 0
src/main/resources/application-prod.yml

@@ -0,0 +1,26 @@
+spring:
+  application:
+    name: mall-carousel-service
+  jpa:
+#    hibernate:
+#      ddl-auto:
+#        create-drop
+    properties:
+      hibernate:
+        hbm2ddl:
+          auto: update
+    # disable open EntityManager in View
+    open-in-view: false
+  datasource:
+    url: jdbc:mysql://10.10.0.208:3306/mall_home?useUnicode=true&characterEncoding=utf-8
+    username: sa
+    password: Select123!#%*(
+    driver-class-name: com.mysql.jdbc.Driver
+
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://10.10.0.187:28000/eureka/
+  instance:
+    ip-address: 10.10.0.188
+    prefer-ip-address: true

+ 6 - 0
src/main/resources/application.yml

@@ -0,0 +1,6 @@
+
+server:
+  port: 20030
+spring:
+  profiles:
+    active: dev

+ 0 - 0
README.md → src/main/resources/bootstrap-dev.yml


+ 1 - 0
src/main/resources/bootstrap-prod.yml

@@ -0,0 +1 @@
+

+ 0 - 0
src/main/resources/bootstrap-test.yml


+ 1 - 0
src/main/resources/bootstrap.yml

@@ -0,0 +1 @@
+

+ 55 - 0
src/test/java/com/uas/cloud/mall/carousel/CarouselApplicationTest.java

@@ -0,0 +1,55 @@
+package com.uas.cloud.mall.carousel;
+
+import com.uas.cloud.mall.carousel.domain.Carousel;
+import com.uas.cloud.mall.carousel.service.CarouselService;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by yangck on 2017/2/16.
+ */
+/*@RunWith(SpringJUnit4ClassRunner.class)
+@SpringApplicationConfiguration(CarouselApplication.class)*/
+public class CarouselApplicationTest {
+
+   /* @Autowired
+    private CarouselService carouselService;
+
+    @Before
+    public void before() {
+        carouselService.deleteAll();
+    }
+
+    @Test
+    public void carouselTestData() {
+        Carousel carousel1 = new Carousel(null, "home", 0L, "http://dfs.ubtob.com/group1/M00/17/F3/CgpkyFjaM62AQafMAACiyPLUFOk177.jpg", "", "http://mall.ubtob.com/product#/kinds/100", null, "轮播1");
+        Map<String, String> metadata = new HashMap<>();
+        metadata.put("background-color", "#db143c");
+        carousel1.setMetadata(metadata);
+        carouselService.save(carousel1);
+
+        Carousel carousel2 = new Carousel(null, "home", 100L, "http://dfs.ubtob.com/group1/M00/17/F3/CgpkyFjaM5aAV7RiAADmRfkFf9w389.jpg", null, "http://mall.ubtob.com/product#/kinds/100", null, "轮播2");
+        metadata.put("background-color", "#ff98be");
+        carousel2.setMetadata(metadata);
+        carouselService.save(carousel2);
+
+
+        Carousel carousel3 = new Carousel(null, "store", 0L, "http://dfs.ubtob.com/group1/M00/17/F3/CgpkyFjaM62AQafMAACiyPLUFOk177.jpg", "", "http://mall.ubtob.com/product#/kinds/100", null, "轮播1");
+        metadata.put("background-color", "#db143c");
+        carousel3.setMetadata(metadata);
+        carouselService.save(carousel3);
+
+        Carousel carousel4 = new Carousel(null, "store", 100L, "http://dfs.ubtob.com/group1/M00/17/F3/CgpkyFjaM5aAV7RiAADmRfkFf9w389.jpg", null, "http://mall.ubtob.com/product#/kinds/100", null, "轮播2");
+        metadata.put("background-color", "#ff98be");
+        carousel4.setMetadata(metadata);
+        carouselService.save(carousel4);
+    }*/
+
+}