Просмотр исходного кода

支付模块,订单 接口业务移植

lyhzzz 3 лет назад
Родитель
Сommit
2bbc5ed48c
21 измененных файлов с 557 добавлено и 210 удалено
  1. 34 0
      4dkankan-center-api/4dkankan-center-platform-api/pom.xml
  2. 15 0
      4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/client/PlatformClient.java
  3. 68 0
      4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/vo/Camera.java
  4. 37 1
      4dkankan-center-api/pom.xml
  5. 0 20
      4dkankan-center-platform/src/main/java/com/fdkankan/TestController.java
  6. 22 0
      4dkankan-center-platform/src/main/java/com/fdkankan/feign/platformFeign.java
  7. 9 1
      4dkankan-center-platform/src/main/java/com/fdkankan/order/mapper/IVirtualOrderMapper.java
  8. 12 0
      4dkankan-center-platform/src/main/java/com/fdkankan/order/service/IVirtualOrderService.java
  9. 42 0
      4dkankan-center-platform/src/main/java/com/fdkankan/order/service/impl/VirtualOrderServiceImpl.java
  10. 64 0
      4dkankan-center-platform/src/main/java/com/fdkankan/user/controller/api/UserVirtualOrderController.java
  11. 26 0
      4dkankan-center-platform/src/main/java/com/fdkankan/user/request/RequestDownloadOrder.java
  12. 5 6
      4dkankan-center-platform/src/main/java/com/fdkankan/user/service/LoginService.java
  13. 8 0
      4dkankan-center-platform/src/main/resources/bootstrap.yml
  14. 34 0
      4dkankan-center-platform/src/main/resources/mapper/order/VirtualOrderMapper.xml
  15. 0 1
      4dkankan-center-scene/pom.xml
  16. 1 1
      4dkankan-common/pom.xml
  17. 1 1
      4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantFilePath.java
  18. 4 4
      4dkankan-common/src/main/java/com/fdkankan/common/proto/BigSceneProto.java
  19. 156 156
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/CouchDBFormat.java
  20. 10 10
      4dkankan-common/src/main/java/com/fdkankan/common/proto/format/JsonFormat.java
  21. 9 9
      4dkankan-common/src/main/java/com/fdkankan/common/util/UploadToOssUtil.java

+ 34 - 0
4dkankan-center-api/4dkankan-center-platform-api/pom.xml

@@ -2,6 +2,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">
+    <packaging>jar</packaging>
+
     <parent>
         <artifactId>4dkankan-center-api</artifactId>
         <groupId>com.fdkankan</groupId>
@@ -10,6 +12,38 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>4dkankan-center-platform-api</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-loadbalancer</artifactId>
+        </dependency>
+
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
 </project>

+ 15 - 0
4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/client/PlatformClient.java

@@ -0,0 +1,15 @@
+package com.fdkankan.platform.api.feign.client;
+
+import com.fdkankan.platform.api.feign.vo.Camera;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(value = "4dkankan-center-platform")
+public interface PlatformClient {
+
+    @PostMapping("/platform/feign/findByChildName")
+    Camera findByChildName(@RequestParam(value = "childName",required = false) String childName);
+
+
+}

+ 68 - 0
4dkankan-center-api/4dkankan-center-platform-api/src/main/java/com/fdkankan/platform/api/feign/vo/Camera.java

@@ -0,0 +1,68 @@
+package com.fdkankan.platform.api.feign.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class Camera implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    /**
+     * 相机的Mac地址
+     */
+    private String childName;
+
+    /**
+     * 激活时间
+     */
+    private Date activatedTime;
+
+    /**
+     * 相机密码
+     */
+    private String childPassword;
+
+    /**
+     * sn码
+     */
+    private String snCode;
+
+    /**
+     * wifi名称
+     */
+    private String wifiName;
+
+    /**
+     * wifi密码
+     */
+    private String wifiPassword;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    private String recStatus;
+
+    /**
+     * 0正常,1删除
+     */
+    private Integer tbStatus;
+
+    
+
+}
+

+ 37 - 1
4dkankan-center-api/pom.xml

@@ -2,6 +2,7 @@
 <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">
+    <packaging>jar</packaging>
     <parent>
         <artifactId>4dkankan-parent</artifactId>
         <groupId>com.fdkankan</groupId>
@@ -10,11 +11,46 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>4dkankan-center-api</artifactId>
-    <packaging>pom</packaging>
     <modules>
         <module>4dkankan-center-scene-api</module>
         <module>4dkankan-center-platform-api</module>
     </modules>
 
+    <properties>
+        <java.version>1.8</java.version>
+        <spring-cloud.version>2020.0.2</spring-cloud.version>
+        <spring-cloud-alibaba.version>2020.0.RC1</spring-cloud-alibaba.version>
+        <spring-boot.version>2.4.5</spring-boot.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- spring boot 依赖 -->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
+            <!-- spring cloud 依赖 -->
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>${spring-cloud.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <!-- spring cloud alibaba 依赖 -->
+            <dependency>
+                <groupId>com.alibaba.cloud</groupId>
+                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
+                <version>${spring-cloud-alibaba.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
 
 </project>

+ 0 - 20
4dkankan-center-platform/src/main/java/com/fdkankan/TestController.java

@@ -1,20 +0,0 @@
-package com.fdkankan;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- * 代理商申请表 前端控制器
- * </p>
- *
- * @author 
- * @since 2021-12-23
- */
-@RestController
-@RequestMapping("/test")
-public class TestController {
-
-}
-

+ 22 - 0
4dkankan-center-platform/src/main/java/com/fdkankan/feign/platformFeign.java

@@ -0,0 +1,22 @@
+package com.fdkankan.feign;
+
+import com.fdkankan.goods.entity.Camera;
+import com.fdkankan.goods.service.ICameraService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/feign")
+public class platformFeign {
+
+    @Autowired
+    private ICameraService cameraService;
+
+    @PostMapping("/findByChildName")
+    public Camera findByChildName(
+            @RequestParam(value = "childName", required = false) String childName) {
+        return cameraService.getByChildName(childName);
+    }
+
+
+}

+ 9 - 1
4dkankan-center-platform/src/main/java/com/fdkankan/order/mapper/IVirtualOrderMapper.java

@@ -1,8 +1,12 @@
 package com.fdkankan.order.mapper;
 
-import com.fdkankan.order.entity.VirtualOrder;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fdkankan.order.entity.VirtualOrder;
+import com.fdkankan.user.vo.ResponseVirtualOrder;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -15,4 +19,8 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IVirtualOrderMapper extends BaseMapper<VirtualOrder> {
 
+    List<ResponseVirtualOrder> getChargeListByParam(@Param("userId")Long userId,@Param("status")String status,@Param("childName")String childName,
+                                                    @Param("cameraId")Long cameraId,@Param("start")Integer start,@Param("pageSize")Integer pageSize);
+    Integer getChargeCountByParam(@Param("userId")Long userId,@Param("status")String status,@Param("childName")String childName,
+                                                    @Param("cameraId")Long cameraId,@Param("start")Integer start,@Param("pageSize")Integer pageSize);
 }

+ 12 - 0
4dkankan-center-platform/src/main/java/com/fdkankan/order/service/IVirtualOrderService.java

@@ -1,10 +1,14 @@
 package com.fdkankan.order.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.agent.vo.AgentVo;
 import com.fdkankan.agent.vo.ResponseAgentCamera;
 import com.fdkankan.order.entity.VirtualOrder;
 import com.fdkankan.user.request.RequestCamera;
+import com.fdkankan.user.request.RequestDownloadOrder;
+import com.fdkankan.user.request.RequestIncrementOrder;
+import com.fdkankan.user.request.RequestVirtualOrder;
 import com.fdkankan.user.vo.ResponseVirtualOrder;
 
 /**
@@ -24,4 +28,12 @@ public interface IVirtualOrderService extends IService<VirtualOrder> {
     ResponseAgentCamera getPointsByCameraId(Long cameraId, String startDate, String endDate);
 
     ResponseVirtualOrder saveByCamera(Long id, RequestCamera param);
+
+    Page<ResponseVirtualOrder> chargeList(RequestVirtualOrder param, String token);
+
+    String expansionList(RequestCamera param, String token);
+
+    String incrementOrderList(RequestIncrementOrder param, String token);
+
+    String downloadOrderList(RequestDownloadOrder param, String token);
 }

+ 42 - 0
4dkankan-center-platform/src/main/java/com/fdkankan/order/service/impl/VirtualOrderServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fdkankan.order.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.agent.constant.AgentConstant;
 import com.fdkankan.agent.vo.AgentVo;
@@ -12,12 +13,19 @@ import com.fdkankan.common.util.NumberUtils;
 import com.fdkankan.order.entity.VirtualOrder;
 import com.fdkankan.order.mapper.IVirtualOrderMapper;
 import com.fdkankan.order.service.IVirtualOrderService;
+import com.fdkankan.user.entity.SSOUser;
 import com.fdkankan.user.request.RequestCamera;
+import com.fdkankan.user.request.RequestDownloadOrder;
+import com.fdkankan.user.request.RequestIncrementOrder;
+import com.fdkankan.user.request.RequestVirtualOrder;
+import com.fdkankan.user.service.IUserService;
 import com.fdkankan.user.vo.ResponseVirtualOrder;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
@@ -33,6 +41,11 @@ import java.util.List;
 @Service
 public class VirtualOrderServiceImpl extends ServiceImpl<IVirtualOrderMapper, VirtualOrder> implements IVirtualOrderService {
 
+    @Resource
+    private IVirtualOrderMapper virtualOrderMapper;
+    @Autowired
+    private IUserService userService;
+
     @Override
     public void saveVirtualOrderByAgent(Long cameraId) {
         VirtualOrder virtualOrderEntity = new VirtualOrder();
@@ -212,4 +225,33 @@ public class VirtualOrderServiceImpl extends ServiceImpl<IVirtualOrderMapper, Vi
         BeanUtils.copyProperties(virtualOrderEntity, responseVirtualOrder);
         return responseVirtualOrder;
     }
+
+    @Override
+    public Page<ResponseVirtualOrder> chargeList(RequestVirtualOrder param, String token) {
+        SSOUser ssouser = userService.getSSOUserByToken(token);
+        param.setUserId(ssouser.getId());
+        Integer start = (param.getPageNum() -1) * param.getPageSize();
+        List<ResponseVirtualOrder> orders =  virtualOrderMapper.getChargeListByParam(param.getUserId(),param.getStatus(),param.getChildName(),param.getCameraId(),start,param.getPageSize());
+        Integer count =  virtualOrderMapper.getChargeCountByParam(param.getUserId(),param.getStatus(),param.getChildName(),param.getCameraId(),start,param.getPageSize());
+
+        Page<ResponseVirtualOrder> pageVo = new Page<>(param.getPageNum(), param.getPageSize());
+        pageVo.setTotal(count);
+        pageVo.setRecords(orders);
+        return pageVo;
+    }
+
+    @Override
+    public String expansionList(RequestCamera param, String token) {
+        return null;
+    }
+
+    @Override
+    public String incrementOrderList(RequestIncrementOrder param, String token) {
+        return null;
+    }
+
+    @Override
+    public String downloadOrderList(RequestDownloadOrder param, String token) {
+        return null;
+    }
 }

+ 64 - 0
4dkankan-center-platform/src/main/java/com/fdkankan/user/controller/api/UserVirtualOrderController.java

@@ -0,0 +1,64 @@
+package com.fdkankan.user.controller.api;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.order.service.IVirtualOrderService;
+import com.fdkankan.user.request.RequestCamera;
+import com.fdkankan.user.request.RequestDownloadOrder;
+import com.fdkankan.user.request.RequestIncrementOrder;
+import com.fdkankan.user.request.RequestVirtualOrder;
+import com.fdkankan.user.vo.ResponseVirtualOrder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 个人中心-我的虚拟订单
+ */
+@RestController
+@RequestMapping("/api/user/virtualOrder")
+public class UserVirtualOrderController {
+
+    private static Logger log = LoggerFactory.getLogger("programLog");
+
+    @Autowired
+    private IVirtualOrderService virtualOrderService;
+
+
+    /**
+     * 获取用户充值记录
+     * status     状态,-1表示支出,1表示充值,0表示系统赠送,-2表示系统退充值
+     * childName     设备id
+     * @return
+     */
+    @RequestMapping(value = "/chargeList", method = RequestMethod.POST)
+    public Page<ResponseVirtualOrder> chargeList(@RequestBody RequestVirtualOrder param, @RequestHeader String token) throws Exception {
+        return virtualOrderService.chargeList(param,token);
+    }
+    /**
+     * 获取用户扩容记录
+     * childName     设备id
+     */
+    @RequestMapping(value = "/expansionList", method = RequestMethod.POST)
+    public String expansionList(@RequestBody RequestCamera param, @RequestHeader String token) throws Exception {
+        return virtualOrderService.expansionList(param,token);
+    }
+    /**
+     * 获取会员权益记录
+     * snCode     相机sn编码
+     */
+    @RequestMapping(value = "/incrementOrderList", method = RequestMethod.POST)
+    public String incrementOrderList(@RequestBody RequestIncrementOrder param, @RequestHeader String token) throws Exception {
+        return virtualOrderService.incrementOrderList(param,token);
+    }
+    /**
+     * 获取用户下载订单
+     * snCode     相机sn编码
+     */
+    @RequestMapping(value = "/downloadOrderList", method = RequestMethod.POST)
+    public String downloadOrderList(@RequestBody RequestDownloadOrder param, @RequestHeader String token) throws Exception {
+        return virtualOrderService.downloadOrderList(param,token);
+    }
+
+
+}

+ 26 - 0
4dkankan-center-platform/src/main/java/com/fdkankan/user/request/RequestDownloadOrder.java

@@ -0,0 +1,26 @@
+package com.fdkankan.user.request;
+
+import com.fdkankan.common.request.RequestBase;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class RequestDownloadOrder extends RequestBase implements Serializable {
+
+    private static final long serialVersionUID = 6503649644925734099L;
+    /**
+     *  t_goods_sku的skuSn
+     */
+    private String skuSn;
+    /**
+     * 数量
+     */
+    private int count;
+    /**
+     * 付款方式,0表示微信,1表示支付宝,2表示paypal,3表示其他
+     */
+    private int payType;
+    // 0表示国内订单,1表示国外订单
+    private Integer abroad;
+}

+ 5 - 6
4dkankan-center-platform/src/main/java/com/fdkankan/user/service/LoginService.java

@@ -44,9 +44,8 @@ public class LoginService {
             throw new BusinessException(ErrorCode.USER_NOT_EXIST);
         }
         //对前端传的密码解密
-        String password = Base64Converter.decode(Base64Converter.subText(ssoUser.getPassword()));
-        ssoUser.setPassword(password);
-        String token = this.commonLogin(ssoUser);
+        String password = Base64Converter.decode(Base64Converter.subText(param.getPassword()));
+        String token = this.commonLogin(ssoUser,password);
         this.removeTimeOutToken(param.getPhoneNum(),token);
         return  userService.getUserInfoByUser(param.getCameraType(), dbUser,token);
     }
@@ -146,7 +145,7 @@ public class LoginService {
         }
         SSOUser ssoUser = userService.getSsoUserByUserName(userByUserName, phoneNum);
 
-        return this.commonLogin(ssoUser);
+        return this.commonLogin(ssoUser,password);
     }
 
 
@@ -185,8 +184,8 @@ public class LoginService {
     }
 
 
-    private String commonLogin(SSOUser ssoUser){
-        String passwordCode = SecurityUtil.MD5(ssoUser.getPassword());
+    private String commonLogin(SSOUser ssoUser,String password){
+        String passwordCode = SecurityUtil.MD5(password);
         if (!passwordCode.equals(ssoUser.getPassword())){
             throw new BusinessException(ErrorCode.PASSWORD_ERROR);
         }

+ 8 - 0
4dkankan-center-platform/src/main/resources/bootstrap.yml

@@ -19,6 +19,14 @@ spring:
           - data-id: common-mq-config.yaml
             group: DEFAULT_GROUP
             refresh: true
+
+          - data-id: oss-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: other-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
       discovery:
         server-addr: 192.168.0.47:8848
         namespace: 4dkankan-dev

+ 34 - 0
4dkankan-center-platform/src/main/resources/mapper/order/VirtualOrderMapper.xml

@@ -2,4 +2,38 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.order.mapper.IVirtualOrderMapper">
 
+    <select id="getChargeListByParam" resultType="com.fdkankan.user.vo.ResponseVirtualOrder">
+        SELECT o.id, o.order_sn, o.points, c.child_name, o.pay_type, o.body, o.trade_time, o.status from t_virtual_order o
+        LEFT JOIN t_camera c on o.camera_id = c.id  WHERE o.rec_status = 'A' and o.pay_status = 1   and o.pay_type = 0
+        <if test=" userId != null and userId !='' " >
+            and o.user_id = ${userId}
+        </if>
+        <if test=" status != null and status !='' " >
+            and o.status = ${status}
+        </if>
+        <if test=" childName != null and childName !='' " >
+            and c.child_name like concat('%',#{childName},'%')
+        </if>
+        <if test=" cameraId != null and cameraId !='' " >
+            and o.camera_id = ${cameraId}
+        </if>
+        limit ${start}, ${pageSize}
+    </select>
+
+    <select id="getChargeCountByParam" resultType="integer">
+        SELECT count (*) from t_virtual_order o
+        LEFT JOIN t_camera c on o.camera_id = c.id  WHERE o.rec_status = 'A' and o.pay_status = 1   and o.pay_type = 0
+        <if test=" userId != null and userId !='' " >
+            and o.user_id = ${userId}
+        </if>
+        <if test=" status != null and status !='' " >
+            and o.status = ${status}
+        </if>
+        <if test=" childName != null and childName !='' " >
+            and c.child_name like concat('%',#{childName},'%')
+        </if>
+        <if test=" cameraId != null and cameraId !='' " >
+            and o.camera_id = ${cameraId}
+        </if>
+    </select>
 </mapper>

+ 0 - 1
4dkankan-center-scene/pom.xml

@@ -16,7 +16,6 @@
     </properties>
 
     <dependencies>
-
         <dependency>
             <groupId>com.fdkankan</groupId>
             <artifactId>4dkankan-common</artifactId>

+ 1 - 1
4dkankan-common/pom.xml

@@ -147,7 +147,7 @@
         <dependency>
             <groupId>com.qiniu</groupId>
             <artifactId>qiniu-java-sdk</artifactId>
-            <version>7.0.2</version>
+            <version>7.2.0</version>
         </dependency>
 
         <dependency>

+ 1 - 1
4dkankan-common/src/main/java/com/fdkankan/common/constant/ConstantFilePath.java

@@ -47,7 +47,7 @@ public class ConstantFilePath {
 
     public static final String OSS_PREFIX = "home/";
 
-    @Value("${file.route.hardDiskLaser}")
+    @Value("${file.route.hardDiskLaser:/mnt-laser/data/}")
     public void setHardDiskLaser(String value){
         ConstantFilePath.BUILD_MODEL_LASER_PATH = value;
     }

+ 4 - 4
4dkankan-common/src/main/java/com/fdkankan/common/proto/BigSceneProto.java

@@ -12,7 +12,7 @@ public final class BigSceneProto {
     /**
      * <code>repeated .tutorial.chunk_simple chunk = 1;</code>
      */
-    java.util.List<com.fdkankan.common.proto.BigSceneProto.chunk_simple> 
+    java.util.List<com.fdkankan.common.proto.BigSceneProto.chunk_simple>
         getChunkList();
     /**
      * <code>repeated .tutorial.chunk_simple chunk = 1;</code>
@@ -25,7 +25,7 @@ public final class BigSceneProto {
     /**
      * <code>repeated .tutorial.chunk_simple chunk = 1;</code>
      */
-    java.util.List<? extends com.fdkankan.common.proto.BigSceneProto.chunk_simpleOrBuilder> 
+    java.util.List<? extends com.fdkankan.common.proto.BigSceneProto.chunk_simpleOrBuilder>
         getChunkOrBuilderList();
     /**
      * <code>repeated .tutorial.chunk_simple chunk = 1;</code>
@@ -36,7 +36,7 @@ public final class BigSceneProto {
     /**
      * <code>repeated .tutorial.chunk_quantized quantized_chunk = 2;</code>
      */
-    java.util.List<com.fdkankan.common.proto.BigSceneProto.chunk_quantized> 
+    java.util.List<com.fdkankan.common.proto.BigSceneProto.chunk_quantized>
         getQuantizedChunkList();
     /**
      * <code>repeated .tutorial.chunk_quantized quantized_chunk = 2;</code>
@@ -49,7 +49,7 @@ public final class BigSceneProto {
     /**
      * <code>repeated .tutorial.chunk_quantized quantized_chunk = 2;</code>
      */
-    java.util.List<? extends com.fdkankan.common.proto.BigSceneProto.chunk_quantizedOrBuilder> 
+    java.util.List<? extends com.fdkankan.common.proto.BigSceneProto.chunk_quantizedOrBuilder>
         getQuantizedChunkOrBuilderList();
     /**
      * <code>repeated .tutorial.chunk_quantized quantized_chunk = 2;</code>

+ 156 - 156
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/CouchDBFormat.java

@@ -1,156 +1,156 @@
-package com.fdkankan.common.proto.format;
-
-
-import com.google.protobuf.ExtensionRegistry;
-import com.google.protobuf.Message;
-import com.google.protobuf.UnknownFieldSet;
-
-import java.io.IOException;
-
-/**
- * Created by IntelliJ IDEA.
- * User: aantonov
- * Date: Mar 16, 2010
- * Time: 4:06:05 PM
- * To change this template use File | Settings | File Templates.
- */
-public class CouchDBFormat extends JsonFormat {
-
-    /**
-     * Outputs a textual representation of the Protocol Message supplied into the parameter output.
-     * (This representation is the new version of the classic "ProtocolPrinter" output from the
-     * original Protocol Buffer system)
-     */
-    public static void print(Message message, Appendable output) throws IOException {
-        CouchDBGenerator generator = new CouchDBGenerator(output);
-        generator.print("{");
-        print(message, generator);
-        generator.print("}");
-    }
-
-    /**
-     * Outputs a textual representation of {@code fields} to {@code output}.
-     */
-    public static void print(UnknownFieldSet fields, Appendable output) throws IOException {
-        CouchDBGenerator generator = new CouchDBGenerator(output);
-        generator.print("{");
-        printUnknownFields(fields, generator);
-        generator.print("}");
-    }
-
-    /**
-     * Like {@code print()}, but writes directly to a {@code String} and returns it.
-     */
-    public static String printToString(Message message) {
-        try {
-            StringBuilder text = new StringBuilder();
-            print(message, text);
-            return text.toString();
-        } catch (IOException e) {
-            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
-                                       e);
-        }
-    }
-
-    /**
-     * Like {@code print()}, but writes directly to a {@code String} and returns it.
-     */
-    public static String printToString(UnknownFieldSet fields) {
-        try {
-            StringBuilder text = new StringBuilder();
-            print(fields, text);
-            return text.toString();
-        } catch (IOException e) {
-            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
-                                       e);
-        }
-    }
-
-    /**
-     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
-     */
-    public static void merge(Readable input, Message.Builder builder) throws IOException {
-        merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
-    }
-
-    /**
-     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
-     */
-    public static void merge(CharSequence input, Message.Builder builder) throws ParseException {
-        merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
-    }
-
-    /**
-     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
-     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
-     */
-    public static void merge(Readable input,
-                             ExtensionRegistry extensionRegistry,
-                             Message.Builder builder) throws IOException {
-        // Read the entire input to a String then parse that.
-
-        // If StreamTokenizer were not quite so crippled, or if there were a kind
-        // of Reader that could read in chunks that match some particular regex,
-        // or if we wanted to write a custom Reader to tokenize our stream, then
-        // we would not have to read to one big String. Alas, none of these is
-        // the case. Oh well.
-
-        merge(JsonFormat.toStringBuilder(input), extensionRegistry, builder);
-    }
-
-    /**
-     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
-     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
-     */
-    public static void merge(CharSequence input,
-                             ExtensionRegistry extensionRegistry,
-                             Message.Builder builder) throws ParseException {
-        Tokenizer tokenizer = new Tokenizer(input);
-
-        // Based on the state machine @ http://json.org/
-
-        tokenizer.consume("{"); // Needs to happen when the object starts.
-        while (!tokenizer.tryConsume("}")) { // Continue till the object is done
-            JsonFormat.mergeField(tokenizer, extensionRegistry, builder);
-        }
-    }
-
-    protected static class Tokenizer extends JsonFormat.Tokenizer {
-
-        /**
-         * Construct a tokenizer that parses tokens from the given text.
-         */
-        public Tokenizer(CharSequence text) {
-            super(text);
-        }
-
-        @Override
-        public String consumeIdentifier() throws ParseException {
-            String id = super.consumeIdentifier();
-            if ("_id".equals(id)) {
-                return "id";
-            } else if ("_rev".equals(id)) {
-                return "rev";
-            }
-            return id;
-        }
-    }
-
-    protected static class CouchDBGenerator extends JsonGenerator {
-
-        public CouchDBGenerator(Appendable output) {
-            super(output);
-        }
-
-        @Override
-        public void print(CharSequence text) throws IOException {
-            if ("id".equals(text)) {
-                super.print("_id");
-            } else if ("rev".equals(text)) {
-                super.print("_rev");
-            } else {
-                super.print(text);
-            }
-        }
-    }
-}
+//package com.fdkankan.common.proto.format;
+//
+//
+//import com.google.protobuf.ExtensionRegistry;
+//import com.google.protobuf.Message;
+//import com.google.protobuf.UnknownFieldSet;
+//
+//import java.io.IOException;
+//
+///**
+// * Created by IntelliJ IDEA.
+// * User: aantonov
+// * Date: Mar 16, 2010
+// * Time: 4:06:05 PM
+// * To change this template use File | Settings | File Templates.
+// */
+//public class CouchDBFormat extends JsonFormat {
+//
+//    /**
+//     * Outputs a textual representation of the Protocol Message supplied into the parameter output.
+//     * (This representation is the new version of the classic "ProtocolPrinter" output from the
+//     * original Protocol Buffer system)
+//     */
+//    public static void print(Message message, Appendable output) throws IOException {
+//        CouchDBGenerator generator = new CouchDBGenerator(output);
+//        generator.print("{");
+//        print(message, generator);
+//        generator.print("}");
+//    }
+//
+//    /**
+//     * Outputs a textual representation of {@code fields} to {@code output}.
+//     */
+//    public static void print(UnknownFieldSet fields, Appendable output) throws IOException {
+//        CouchDBGenerator generator = new CouchDBGenerator(output);
+//        generator.print("{");
+//        printUnknownFields(fields, generator);
+//        generator.print("}");
+//    }
+//
+//    /**
+//     * Like {@code print()}, but writes directly to a {@code String} and returns it.
+//     */
+//    public static String printToString(Message message) {
+//        try {
+//            StringBuilder text = new StringBuilder();
+//            print(message, text);
+//            return text.toString();
+//        } catch (IOException e) {
+//            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
+//                                       e);
+//        }
+//    }
+//
+//    /**
+//     * Like {@code print()}, but writes directly to a {@code String} and returns it.
+//     */
+//    public static String printToString(UnknownFieldSet fields) {
+//        try {
+//            StringBuilder text = new StringBuilder();
+//            print(fields, text);
+//            return text.toString();
+//        } catch (IOException e) {
+//            throw new RuntimeException("Writing to a StringBuilder threw an IOException (should never happen).",
+//                                       e);
+//        }
+//    }
+//
+//    /**
+//     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+//     */
+//    public static void merge(Readable input, Message.Builder builder) throws IOException {
+//        merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
+//    }
+//
+//    /**
+//     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+//     */
+//    public static void merge(CharSequence input, Message.Builder builder) throws ParseException {
+//        merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
+//    }
+//
+//    /**
+//     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+//     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
+//     */
+//    public static void merge(Readable input,
+//                             ExtensionRegistry extensionRegistry,
+//                             Message.Builder builder) throws IOException {
+//        // Read the entire input to a String then parse that.
+//
+//        // If StreamTokenizer were not quite so crippled, or if there were a kind
+//        // of Reader that could read in chunks that match some particular regex,
+//        // or if we wanted to write a custom Reader to tokenize our stream, then
+//        // we would not have to read to one big String. Alas, none of these is
+//        // the case. Oh well.
+//
+//        merge(JsonFormat.toStringBuilder(input), extensionRegistry, builder);
+//    }
+//
+//    /**
+//     * Parse a text-format message from {@code input} and merge the contents into {@code builder}.
+//     * Extensions will be recognized if they are registered in {@code extensionRegistry}.
+//     */
+//    public static void merge(CharSequence input,
+//                             ExtensionRegistry extensionRegistry,
+//                             Message.Builder builder) throws ParseException {
+//        Tokenizer tokenizer = new Tokenizer(input);
+//
+//        // Based on the state machine @ http://json.org/
+//
+//        tokenizer.consume("{"); // Needs to happen when the object starts.
+//        while (!tokenizer.tryConsume("}")) { // Continue till the object is done
+//            JsonFormat.mergeField(tokenizer, extensionRegistry, builder);
+//        }
+//    }
+//
+//    protected static class Tokenizer extends JsonFormat.Tokenizer {
+//
+//        /**
+//         * Construct a tokenizer that parses tokens from the given text.
+//         */
+//        public Tokenizer(CharSequence text) {
+//            super(text);
+//        }
+//
+//        @Override
+//        public String consumeIdentifier() throws ParseException {
+//            String id = super.consumeIdentifier();
+//            if ("_id".equals(id)) {
+//                return "id";
+//            } else if ("_rev".equals(id)) {
+//                return "rev";
+//            }
+//            return id;
+//        }
+//    }
+//
+//    protected static class CouchDBGenerator extends JsonGenerator {
+//
+//        public CouchDBGenerator(Appendable output) {
+//            super(output);
+//        }
+//
+//        @Override
+//        public void print(CharSequence text) throws IOException {
+//            if ("id".equals(text)) {
+//                super.print("_id");
+//            } else if ("rev".equals(text)) {
+//                super.print("_rev");
+//            } else {
+//                super.print(text);
+//            }
+//        }
+//    }
+//}

+ 10 - 10
4dkankan-common/src/main/java/com/fdkankan/common/proto/format/JsonFormat.java

@@ -1,18 +1,18 @@
 package com.fdkankan.common.proto.format;
-/* 
+/*
 	Copyright (c) 2009, Orbitz World Wide
 	All rights reserved.
 
-	Redistribution and use in source and binary forms, with or without modification, 
+	Redistribution and use in source and binary forms, with or without modification,
 	are permitted provided that the following conditions are met:
 
-		* Redistributions of source code must retain the above copyright notice, 
+		* Redistributions of source code must retain the above copyright notice,
 		  this list of conditions and the following disclaimer.
-		* Redistributions in binary form must reproduce the above copyright notice, 
-		  this list of conditions and the following disclaimer in the documentation 
+		* Redistributions in binary form must reproduce the above copyright notice,
+		  this list of conditions and the following disclaimer in the documentation
 		  and/or other materials provided with the distribution.
-		* Neither the name of the Orbitz World Wide nor the names of its contributors 
-		  may be used to endorse or promote products derived from this software 
+		* Neither the name of the Orbitz World Wide nor the names of its contributors
+		  may be used to endorse or promote products derived from this software
 		  without specific prior written permission.
 
 	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -915,7 +915,7 @@ public class JsonFormat {
             field = type.findFieldByNumber(Integer.parseInt(name));
             unknown = true;
         }
-        
+
         // Finally, look for extensions
         extension = extensionRegistry.findExtensionByName(name);
         if (extension != null) {
@@ -1194,7 +1194,7 @@ public class JsonFormat {
         }
         return builder.toString();
     }
-	
+
 	static String unicodeEscaped(char ch) {
 		if (ch < 0x10) {
 			return "\\u000" + Integer.toHexString(ch);
@@ -1322,7 +1322,7 @@ public class JsonFormat {
     /**
      * Implements JSON string escaping as specified <a href="http://www.ietf.org/rfc/rfc4627.txt">here</a>.
      * <ul>
-     *  <li>The following characters are escaped by prefixing them with a '\' : \b,\f,\n,\r,\t,\,"</li> 
+     *  <li>The following characters are escaped by prefixing them with a '\' : \b,\f,\n,\r,\t,\,"</li>
      *  <li>Other control characters in the range 0x0000-0x001F are escaped using the \\uXXXX notation</li>
      *  <li>UTF-16 surrogate pairs are encoded using the \\uXXXX\\uXXXX notation</li>
      *  <li>any other character is printed as-is</li>

+ 9 - 9
4dkankan-common/src/main/java/com/fdkankan/common/util/UploadToOssUtil.java

@@ -52,33 +52,33 @@ public class UploadToOssUtil {
 	Configuration config = new Configuration(zone);
 	UploadManager uploadManager = new UploadManager(config);
 
-	@Value("${oss.point}")
+	@Value("${oss.point:http://oss-cn-shenzhen-internal.aliyuncs.com}")
 	private String point;
 
-	@Value("${oss.key}")
+	@Value("${oss.key:LTAIUrvuHqj8pvry}")
 	private String key;
 
-	@Value("${oss.secrey}")
+	@Value("${oss.secrey:JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4}")
 	private String secrey;
 
-	@Value("${oss.bucket.bucket}")
+	@Value("${oss.bucket.bucket:4dkankan}")
 	private String bucket;
 
-	@Value("${oss.bucket.sdk}")
+	@Value("${oss.bucket.sdk:4dscene}")
 	private String bucketSdk;
 
 
 
-	@Value("${oss.type}")
+	@Value("${oss.type:oss}")
 	private String type;
 
-	@Value("${oss.s3key}")
+	@Value("${oss.s3key:AKIAWCV5QFZ3ZNELKYUY}")
 	private String s3key;
 
-	@Value("${oss.s3secrey}")
+	@Value("${oss.s3secrey:epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws}")
 	private String s3secrey;
 
-	@Value("${oss.s3bucket}")
+	@Value("${oss.s3bucket:4dkankan}")
 	private String s3bucket;