jk-GitHub-coder 4 years ago
parent
commit
3caceb22b7

+ 6 - 1
YijiaRestful/pom.xml

@@ -116,7 +116,12 @@
         <dependency>
         <dependency>
             <groupId>com.alibaba</groupId>
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>
             <artifactId>fastjson</artifactId>
-            <version>1.2.37</version>
+            <version>1.2.54</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+            <version>2.10.4</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <groupId>org.apache.httpcomponents</groupId>

+ 43 - 0
YijiaRestful/src/main/java/com/platform/yijia/config/WebConfig.java

@@ -0,0 +1,43 @@
+//package com.platform.yijia.config;
+//
+//import com.fasterxml.jackson.databind.DeserializationFeature;
+//import com.fasterxml.jackson.databind.ObjectMapper;
+//import com.fasterxml.jackson.databind.module.SimpleModule;
+//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.http.converter.HttpMessageConverter;
+//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+//
+//import java.text.SimpleDateFormat;
+//import java.util.List;
+//
+///**
+// * WebMvc配置
+// * @author JK
+// */
+//@Configuration
+//public class WebConfig implements WebMvcConfigurer {
+//
+//    @Value("${spring.jackson.date-format}")
+//    private String dateFormatPattern;
+//
+//    @Override
+//    public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
+//        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
+//        ObjectMapper objectMapper = converter.getObjectMapper();
+//        // 生成JSON时,将所有Long转换成String
+////        SimpleModule simpleModule = new SimpleModule();
+////        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+////        simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+////        objectMapper.registerModule(simpleModule);
+//        // 时间格式化
+////        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+//        objectMapper.setDateFormat(new SimpleDateFormat(dateFormatPattern));
+//        // 设置格式化内容
+//        converter.setObjectMapper(objectMapper);
+//        converters.add(0, converter);
+//    }
+//
+//}

+ 2 - 0
YijiaRestful/src/main/java/com/platform/yijia/controller/IntegralShoppingMallController.java

@@ -207,6 +207,8 @@ public class IntegralShoppingMallController {
                         //插入客户积分记录
                         //插入客户积分记录
                         customerPointsRecordService.insertCustomerPointsInfo(customerPointsRecord);
                         customerPointsRecordService.insertCustomerPointsInfo(customerPointsRecord);
 
 
+                        integralOrder.setWaresPic(integralWaresInfo.getWaresPic());
+                        integralOrder.setWaresDetail(integralWaresInfo.getWaresDetail());
                         boolean b = integralOrderService.insertIntegralOrder(integralOrder);
                         boolean b = integralOrderService.insertIntegralOrder(integralOrder);
                         if (b){
                         if (b){
                             //公众号积分消耗消息推送
                             //公众号积分消耗消息推送

+ 3 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/CustomerPoints.java

@@ -1,5 +1,6 @@
 package com.platform.yijia.pojo;
 package com.platform.yijia.pojo;
 
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.util.Date;
 import java.util.Date;
@@ -20,9 +21,11 @@ public class CustomerPoints {
     private Integer consumptionPoints;           //用户消费累计积分
     private Integer consumptionPoints;           //用户消费累计积分
     private Integer accumulatePoints;            //用户累计积分
     private Integer accumulatePoints;            //用户累计积分
     private Integer invalidPoints;               //用户失效累计积分
     private Integer invalidPoints;               //用户失效累计积分
+    //@JsonFormat(pattern = "yyyy.MM.dd HH:mm:ss")
     private Date recentConsumptionDate;          //用户最近消费积分时间
     private Date recentConsumptionDate;          //用户最近消费积分时间
     private Integer stationId;                   //油站ID
     private Integer stationId;                   //油站ID
     private String stationName;                  //油站名称
     private String stationName;                  //油站名称
+    //@JsonFormat(pattern = "yyyy.MM.dd HH:mm:ss")
     private Date createTime;                     //创建时间
     private Date createTime;                     //创建时间
 
 
 }
 }

+ 0 - 2
YijiaRestful/src/main/java/com/platform/yijia/pojo/CustomerPointsRecord.java

@@ -1,6 +1,5 @@
 package com.platform.yijia.pojo;
 package com.platform.yijia.pojo;
 
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.util.Date;
 import java.util.Date;
@@ -15,7 +14,6 @@ public class CustomerPointsRecord {
     private String customerName;    //用户名称
     private String customerName;    //用户名称
     private String recordType;      //积分记录类型:-,消耗; +,增加;
     private String recordType;      //积分记录类型:-,消耗; +,增加;
     private Integer integral;       //积分
     private Integer integral;       //积分
-    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;        //创建时间
     private Date createTime;        //创建时间
     private Integer stationId;      //油站ID
     private Integer stationId;      //油站ID
     private String stationName;     //油站名称
     private String stationName;     //油站名称

+ 2 - 0
YijiaRestful/src/main/java/com/platform/yijia/pojo/IntegralOrder.java

@@ -14,6 +14,8 @@ public class IntegralOrder {
     private  String waresType;           //'商品类型',
     private  String waresType;           //'商品类型',
     private  String waresName;           //'商品名称',
     private  String waresName;           //'商品名称',
     private  Integer waresId;           //'商品名称',
     private  Integer waresId;           //'商品名称',
+    private  String waresPic;           //商品图片
+    private  String waresDetail;           //商品详情
     private  String unionId;             //'微信唯一标识',
     private  String unionId;             //'微信唯一标识',
     private  String openId;             //'公众号ID',
     private  String openId;             //'公众号ID',
     private  String customerName;        //'会员名称',
     private  String customerName;        //'会员名称',

+ 2 - 1
YijiaRestful/src/main/resources/mapper/CustomerPointsRecordMapper.xml

@@ -15,7 +15,8 @@
 
 
   <!--查询列-->
   <!--查询列-->
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
-    id, union_id, customer_name, record_type, integral, station_id, station_name, create_time
+    id, union_id, customer_name, record_type, integral, station_id, station_name,
+    create_time
   </sql>
   </sql>
 
 
   <!--查询客户积分记录信息-->
   <!--查询客户积分记录信息-->

+ 15 - 1
YijiaRestful/src/main/resources/mapper/IntegralOrderMapper.xml

@@ -8,6 +8,8 @@
     <result column="wares_type"         jdbcType="VARCHAR"      property="waresType" />
     <result column="wares_type"         jdbcType="VARCHAR"      property="waresType" />
     <result column="wares_name"         jdbcType="VARCHAR"      property="waresName" />
     <result column="wares_name"         jdbcType="VARCHAR"      property="waresName" />
     <result column="wares_id"           jdbcType="INTEGER"      property="waresId" />
     <result column="wares_id"           jdbcType="INTEGER"      property="waresId" />
+    <result column="wares_pic"          jdbcType="VARCHAR"      property="waresPic" />
+    <result column="wares_detail"       jdbcType="VARCHAR"      property="waresDetail" />
     <result column="union_id"           jdbcType="VARCHAR"      property="unionId" />
     <result column="union_id"           jdbcType="VARCHAR"      property="unionId" />
     <result column="customer_name"      jdbcType="VARCHAR"      property="customerName" />
     <result column="customer_name"      jdbcType="VARCHAR"      property="customerName" />
     <result column="exchange_num"       jdbcType="INTEGER"      property="exchangeNum" />
     <result column="exchange_num"       jdbcType="INTEGER"      property="exchangeNum" />
@@ -19,7 +21,7 @@
 
 
   <!--查询列-->
   <!--查询列-->
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
-    id, integral_order_no, wares_type, wares_name, wares_name, wares_id, union_id, customer_name, exchange_num, exchange_time,
+    id, integral_order_no, wares_type, wares_name, wares_name, wares_id, wares_pic, wares_detail, union_id, customer_name, exchange_num, exchange_time,
     status, integral, station_id
     status, integral, station_id
   </sql>
   </sql>
 
 
@@ -55,6 +57,12 @@
       <if test="waresId !=null">
       <if test="waresId !=null">
         wares_id,
         wares_id,
       </if>
       </if>
+      <if test="waresPic !=null">
+        wares_pic,
+      </if>
+      <if test="waresDetail !=null">
+        wares_detail,
+      </if>
       <if test="unionId !=null">
       <if test="unionId !=null">
         union_id,
         union_id,
       </if>
       </if>
@@ -93,6 +101,12 @@
       <if test="waresId !=null">
       <if test="waresId !=null">
         #{waresId},
         #{waresId},
       </if>
       </if>
+      <if test="waresPic !=null">
+        #{waresPic},
+      </if>
+      <if test="waresDetail !=null">
+        #{waresDetail},
+      </if>
       <if test="unionId !=null">
       <if test="unionId !=null">
         #{unionId},
         #{unionId},
       </if>
       </if>

+ 26 - 0
YijiaRestful/src/test/java/com/palatform/yijia/test.java

@@ -0,0 +1,26 @@
+package com.palatform.yijia;
+
+public class test {
+
+    public static void main(String[] args) {
+        byte[] digesta = {0, 1, 0, 1};
+        byte[] digestb = {0, 0, 0, 1};
+        boolean equal = test.isEqual(digesta, digestb);
+        System.out.println(equal);
+    }
+
+    public static boolean isEqual(byte[] digesta, byte[] digestb) {
+        if (digesta.length != digestb.length) {
+            return false;
+        }
+
+        int result = 0;
+        // time-constant comparison
+        for (int i = 0; i < digesta.length; i++) {
+            result |= digesta[i] ^ digestb[i];
+            System.out.println(digesta[i] ^ digestb[i]);
+            //System.out.println(result);
+        }
+        return result == 0;
+    }
+}